PHP enable sqlite phpinfo states –without-sqlite

PHPphp.inisqlite

I've seen similar questions but none that address my situation adequately. I'm running Apache and PHP 5.3.6 on a amazon cloud server.

phpinfo keeps stating that sqlite is disabled. At least that what it seems from the configure line:

'./configure' ... '--without-sqlite'

In other parts of phpinfo() output:

PDO
PDO drivers     mysql, sqlite
PDO Driver for SQLite 3.x   enabled
SQLite Library  3.6.20 

sqlite3
SQLite3 support enabled
SQLite3 module version  0.7-dev
SQLite Library  3.6.20

Directive   Local Value Master Value
sqlite3.extension_dir   no value    no value

and at least one the following PHP commands fail:

if (!extension_loaded('SQLite') OR !function_exists('sqlite_open'))

Yum install states that both sqlite and pdo-lite are already installed.

I've tried to enable sqlite by editing my local php.ini by adding:

; Enable sqlite3 extension module
extension=sqlite3.so

I've checked the main php.ini (/etc/php.ini) and there is nothing specific about disabling it. In fact, there is a sub-conig file loaded in php.d that also specifies this extension as well as another for the pdo-sqlite

I'm running of things to look for or try. Any suggestions.

How do I find where the PHP configure is stated?

Thanks

Best Answer

Your code doesn't specify the extension name correctly, so of course it fails. The correct extension name, as we see, is sqlite3.

if (!extension_loaded('SQLite')...

Anyway.

The RPM build of PHP actually rebuilds PHP four separate times. It is built once without any extensions enabled, for loading into Apache as mod_php, then built again with all extensions as shared memory objects. And a build for the PHP command line, and a fourth build whose purpose I forget right now.

So what happens is, the builds with no extensions built in are bundled with the extensions built from the other build. Thus PHP may say that it was configured without any extensions, yet still be able to use them.

Related Topic