We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Sqlite Adapter

Hi. On the local computer sqlite everything works fine but I have a VPS error "PhalconException: Invalid injected connection servers". I can not understand what was happening. I have another VPS it's all right. May be wrong sqlite installation? File with services https://gist.github.com/bluntik/5458107


Can you copy paste logs sqlite logs ?


I am turned on log sqlite sqlite> .log /var/log/sqlite.log on that right? It is empty. No any records in log.


It's missing the return:

$di->set('db', function(){
   return new \Phalcon\Db\Adapter\Pdo\Sqlite(array(  // <- return
      "dbname" => '/var/www/vobrazcovo/db/vobrazcovo.db'


Ok, thanks. But other problem HTTP 500 (Internal Server Error): if i comment DB service all Ok "PhalconException: Service 'db' wasn't found in the dependency injection container". nginx have not errors in log. If I create other test.php with code in is works

$db = new SQLite3('/var/www/vobrazcovo.ru/db/vobrazcovo.db');
$result = $db->query('SELECT * FROM content');


Phalcon does not use the SQLIte3 driver directly, it uses the PDO-Sqlite driver https://php.net/manual/en/ref.pdo-sqlite.php

$pdo = new PDO('sqlite:/var/www/vobrazcovo/db/vobrazcovo.db'); 


I checked it that works

try {  
$pdo = new PDO('sqlite:/var/www/vobrazcovo.ru/db/vobrazcovo.db'); 
$result = $pdo->query('select * from content')->fetch();
catch(PDOException $e) {  
    echo $e->getMessage();  

But when I run it there is an error 500. And a cannot catch any errors what wrong.


If you want contact me to [email protected] to help you to find the problem


I think there is something in your configuration that is avoiding showing Fatal errors on the screen.

For example, if you execute:

<?php x();

In this script, which actually calls a function that doesn't exist, you can see that no message is shown on the screen too. I saw that PHP is exiting with status code 0377 which means that a fatal error was produced somewhere but I can't figure out where it is. This also is happening instantiating classes that doesn't exist. I assume your problem is related with something like this.

Also, I enabled display_errors = On and error_reporting = E_ALL but it doesn't show the error. I don't have enough information on how the VPS is set up to avoid showing any errors. Maybe you could contact the provider.


Thanks for help. I just re install server and it works.