We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 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



368

Can you copy paste logs sqlite logs ?



7.1k

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



98.9k

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'
   ));
});


7.1k

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');
var_dump($result->fetchArray());


98.9k

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

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


7.1k

I checked it that works

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

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



98.9k

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



98.9k

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.



7.1k

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