ARTICLE AD BOX
Hi i'm received the could not find driver error when trying to connect to sqlite via a php file. I've set permission to 777... PHP Version 5.2.16, i have the module install. any reason why its not finding the driver, also php.ini is showing the extension pdo.so and pdo_mysql.so installed.
PDO
PDO support enabled PDO drivers mysql
pdo_mysql
PDO Driver for MySQL, client library version 5.0.92
try { // Connect to the SQLite Database. $db = new PDO('sqlite:.subscribers.db'); } catch(Exception $e) { die('connection_unsuccessful: ' . $e->getMessage()); }2
I had to actually install the extension, and this is how i did
sudo apt install php-sqlite34 Comments
You need
[PDO_SQLITE] extension=pdo_sqlite.soto be enabled, for sqlite:.subscribers.db
or, for Windows:
[PHP_PDO_SQLITE] extension=php_pdo_sqlite.dllAnd of course this extension in your ext directory.
6 Comments
On archlinux i had to do two things:
first install php-sqlite
pacman -S php-sqliteafter that in my php.ini file for me in /etc/php/php.ini i had to uncomment this line:
;extension=pdo_sqlite.soby removing semicolon.
Dont forget to restart server.
I am using a portable version of PHP on windows, using the inbuilt web server. I found the following steps helped:
Renaming php.ini-development to php.ini Uncommenting extension_dir = "ext" under [PHP] (around line 700) making sure the following lines are in the php.ini: [sqlite3] sqlite3.extension_dir = "ext" extension = sqlite3 extension = pdo_sqlite Running the php webserver with the following flag added on: - c C:\Path\to\PortablePHP\php.iniSo currently my php command is php -S localhost:8081 -c B:\Downloads\php-7.2.6\php.ini.
1,0381 gold badge11 silver badges26 bronze badges
Explore related questions
See similar questions with these tags.



