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 ?



4.3k

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



84.5k

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


4.3k

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 ```php $db = new SQLite3('/var/www/vobrazcovo.ru/db/vobrazcovo.db'); $result = $db->query('SELECT * FROM content'); var_dump($result->fetchArray()); ```



84.5k

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

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


4.3k

I checked it that works ```php <?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.



84.5k

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



84.5k

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 displayerrors = On and errorreporting = 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.



4.3k

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