Bill Kary
Bill Kary

Reputation: 705

Call to undefined function sqlite_escape_string()

i am using sqlite_escape_string($str) to prepare sql statements for future use.

however, when i migrated my code to a new server, it says:

Call to undefined function sqlite_escape_string()

seems the Sqlite and everything is working in the new server, but i have error even for a sqlite_open().

Anyways, i just need to escape my $str to a sqlite safe sql statments, i dun even need to write to sqlite from PHP, so an

Upvotes: 2

Views: 4069

Answers (4)

Darian Brown
Darian Brown

Reputation: 168

For those who recently upgraded to 5.4+, note that the php docs say, this method is not available 5.4+

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

So you would either need to manually compile it in, or look at PECL.

Upvotes: 0

Bill Kary
Bill Kary

Reputation: 705

I found the ans myself.

It is due to my server is a Centos 5.4, and sqlite support for php is not there.

The same case should exist in REL5 also.

see the 1st and 2nd latest comment in the link below:

http://www.php.net/manual/en/sqlite.installation.php

I solved it by recompiling my php and added the sqlite.ini file

Upvotes: 0

arsalankhan
arsalankhan

Reputation: 1

You need to uncomment the extension=php_sqlite.dll line by removing the semi colon right now your pdo_sqlite is enabled and sqlite_escape_string is a function of sqlite extension and sqlite_pdo will not work untill php_sqlite is enabled

Upvotes: 0

mrbellek
mrbellek

Reputation: 2300

That sounds like the SQLite plugin is not enabled for PHP. Write <?=phpinfo()?> in a .php file, load it up on your server and see if SQLite is mentioned in the loaded plugins.

Upvotes: 1

Related Questions