Php – sqlite : Fatal error: Call to undefined function sqlite_escape_string()

databasePHPphp5sqlite

I use a script that requires SQLITE,

On my previous host, it worked. On localhost it works. On my new dedicaced server, it doesn't.

I use PHP5 of course, you can access phpinfo() of the server.

Could you tell me what/how (apt-get?) to install correctly sqlite to avoid this fatal error?

Best Answer

The error you are receiving indicates that the server doesn't have SQLite or its PHP modules installed. You can check the essential parts of the PHP environment by issuing php -i | grep -i sqlite on a terminal. It should result a list containing at least

PDO drivers => sqlite
pdo_sqlite
SQLite Library => <version_number>
PDO Driver for SQLite 3.x => enabled
SQLite support => enabled

You can install SQLite with apt-get install sqlite3 php5-sqlite, although there might sometimes arise issues with PDO drivers and they need to be fiddled with before everything is working.