Linux PHP SQLite – How to Enable SQLite on Linux/Apache/PHP

linuxPHPphp.inisqlite

To enable SQLite on my Windows/Apache/PHP setup, I uncomment the following lines in the php.ini file and restart Apache:

extension=php_pdo.dll
extension=php_pdo_sqlite.dll

Now I have a VPS with Suse Linux 10.3 and Apache/PHP was set automatically. Looking through the php.ini file to make the above changes, I see that things are a little different on Linux:

  • there is no list of extensions to uncomment
  • I found "extension_dir = /usr/lib/php5/extensions" but in this directory find only:
    • pdo.so
    • pdo_mysql.so

How can I enable SQLite in this Linux environment?

Best Answer

i cannot tell how exactly for suse this would work. in debian world it's:

apt-get install php5-sqlite

this will install needed library and add /etc/php5/conf.d/sqlite.ini with

extension=sqlite.so

so first - use yum to see install needed package, then add to php.ini line above.

EDIT: for php7 the command is:

apt-get install php7.0-sqlite

and php.ini file is located at: sudo nano /etc/php/7.0/apache2/php.ini where you have to enable the extension=sqlite.so