6

I want to enable sqlite3 in php.ini but when I try to load a PHP script this error happens:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/sqlite.so' - /usr/lib/php/20151012/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_sqlite.so' - /usr/lib/php/20151012/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0

But the library in this path exists

/usr/lib/php/20151012/sqlite.so

In only change this line in my php.ini

extension=pdo_sqlite.so

My OS is: Debian GNU/Linux 9.4 (stretch)

1 Answer 1

7

Make sure the correct package is installed and apache restarted after:

sudo apt install php7.0-sqlite3
sudo systemctl restart apache2

If that didn't work:

Then, correct the name for the extension in php.ini to:

extension=sqlite3.so
extension=pdo_sqlite.so

And restart apache again: sudo systemctl restart apache2

2
  • same error ` [Thu Jun 21 23:10:18.114761 2018] [:error] [pid 7299] [client 187.211.175.243:50242] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/dist/includes/database.inc.php:30\nStack trace:\n#0 /var/www/html/dist/includes/database.inc.php(30): PDO->__construct('sqlite:/var/db/...', 'null', 'null')\n#1 /var/www/html/dist/upload.php(12): require_once('/var/www/html/d...')\n#2 {main}\n thrown in /var/www/html/dist/includes/database.inc.php on line 30`
    – user472823
    Jun 21, 2018 at 23:11
  • @JorgeEduardoTiradoSandoval that doesn't seem to be the same error. It's reporting that you have a problem with the database and the file you are calling it from, there is no issue with the library now. I think it's another problem now. Jun 22, 2018 at 5:14

You must log in to answer this question.