Jump to content


This topic is now archived and is closed to further replies.


Enabling SQLite in PHP 5.1.4

Recommended Posts

I installed from the zip download to C:\PHP.

I uncommented the extension entry for the SQLite dll in php.ini.

I tried two versions of the extension-dir value...the original which was "./"
and replaced it with "C:\PHP\ext\"  (which is where the SQLite dll seems to be).

When a brief "testSQLite.php"  is run ....it does start up and 'print' literals that I have inside
appear.... until the first call to open or create a SQLite DB is made...then everything stops there
and the 'Done' literal appears at the bottom left of the screen.
Before when I foolishly installed just with the Windows 'installer' download...PHP at least
stated that the requested function could not be found when I ran the SQLite test script;
Now ...... nothing  ?? 

Share this post

Link to post
Share on other sites
have you done a phpinfo(); to see if the extension is actually working?

p.s: i don't claim to be an expert here, or even understand allot of it, but my extension-dir is set to 'C:\php\ext' (without the final trailing slash) and it works.

Share this post

Link to post
Share on other sites
Yes, phpinfo.php works fine.

I changed my extention-dir to "c:\php\ext" .....but it made no difference.

I placed php_pdo.dll,  php_pdo_sqlite.dll  and php_sqlite.dll in the PHP folder
as one input person suggested (they are already in the 'ext' folder....this had
no effect.

I'm hoping I can download SQLite independently of PHP and still work with it.

Thanks...... John

Share this post

Link to post
Share on other sites
When you make changes to the php.ini or move any files around within the PHP folder, you must restart the server.

Also move any php_*.dll files back into the ext folder. And just move the php.ini to the WINDOWS folder. Restart your server. Is PHP now reading the correct php.ini. Also it is a good idea to add the your PHP folder to the WINDOWS PATH variable. To do this do the following:
First goto Start > Control Panel (make sure its set to classic view) > System > Advanced Tab

Now click the Environment Variables button. Look for the Path variable within the System Variables window, scroll down if needed. Select it and press the Edit button. When the Edit System Variable window appears, immediatly press the End key on your keyboard, dont delete anything that is selected. Now add a semi-colon if there isnt one already to the left of the curser. Now type in C:\php;

Click OK to close the Edit System Variable Window. Click OK to close the System Variables Window, Click OK to close the System Properties window. Now restart your PC in order for the new path variable to become available. Now PHP should be able to access its own folder, therefor you dont need to move any files around.

Share this post

Link to post
Share on other sites
I've done it all, to no avail...

Here's the key pieces of php.ini:    (now in c:\windows)
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\PHP\ext"
extension=php_pdo_sqlite.dll  <--- some users observed these had to be 'last' in the series

Here's the autoexec.bat 'path' :  (in c:\windows\command\edb - (it's a Win ME OS))
call \checksr.bat
IF "%config%"=="QUICK" GOTO QUICK    etc.  etc. .....

Here's the 'test' script used on various 'sites'....the 1st (2) 'prints' 'work' - the script stops at the
first call to SQLite....no other output:


//create table
print "Came to script";  <------ this works
print  " ";                    <------ this works     
if(file_exists("test.db")) {
$weNeedToCreateTheDatabase = false;
} else {
$weNeedToCreateTheDatabase = true;


print ($weNeedToCreateTheDatabase);  <------ this works
//create or open database
$db = sqlite_open("test.db") or die("failed to open/create the database");
print ($weNeedToCreateTheDatabase);  <-----this doesn't happen
//create table
if($weNeedToCreateTheDatabase) {
sqlite_query($db, "CREATE TABLE Members(FirstName,LastName)");

//add info
sqlite_query($db,"INSERT INTO Members VALUES ('Jim', 'Rockerton')");

//get info
$dt = sqlite_query($db, "SELECT * FROM Members");
while ($row = sqlite_fetch_array($dt)) {
echo "row: $row[FirstName] $row[LastName]<br/>";

//close database


Share this post

Link to post
Share on other sites
Many thanks to all........success at last.

I had set the PATH by editing the autoexec.bat file. This 'took' but had no effect on the
'ENVIRONMENT'  data that phpinfo  displays.

The suggested tabs in the very helpful 'super guru' notes couldn't quite be followed as the
'tabs' cited were not all present. I found a site that detailed Win ME PATH setting in particular
(it was for Java SDK...but non-the-less).  This allowed success in actually changing the PATH
that is apparently supplied to PHP (I gather it is not 'autoexec.bat'). Adding 'super guru's' suggested
c:\php to 'that' PATH .....finally let SQLite's testScript complete.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.