Page 1 of 2

unable to get sqlite working

Posted: Sat Oct 07, 2006 5:11 am
by raghavan20
i have problem enabling the sqlite module

This is basically a Windows XP installation.
The extension dir: C:\www\php\ext
The actual sqlite extension file name: php_sqlite.dll

I have verified the php.ini file in D:/Windows(%SYSTEMROOT%) is correct .
I have taken off the ; before the module name so it now looks like

Code: Select all

;extension=php_msql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_sybase_ct.dll
this is the php.ini line to search for extensions

Code: Select all

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:/www/php/ext/"

if I run phpinfo(), i can see modules like mysql and mysqli but sqlite and this is the same case even when i try to enable sybase module as well.

EDIT:
I know the sqlite is not working because it reports the following:

Code: Select all

Fatal error: Call to undefined function sqlite_open() in C:\www\Apache2\htdocs\rag\phpinfo.php on line 5
for

Code: Select all

$dbhandle = sqlite_open('sqlitedb');
	sqlite_close($dbhandle);
Please point where I have to do more work to make it work.

Thanks to all

Re: unable to get sqlite working

Posted: Sat Oct 07, 2006 5:39 am
by volka
raghavan20 wrote:I have verified the php.ini file in D:/Windows(%SYSTEMROOT%) is correct .
phpinfo() says so?
Did you try to change another value, like error_reporting, and checked wether phpinfo reflects this change?
Does the apache server restart without errors? Is there something in error.log that might be related to the problem?

Posted: Sat Oct 07, 2006 6:24 am
by raghavan20
i restarted the apache and found this from the log

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/www/php/ext/php_sqlite.dll' - The specified module could not be found.\r\n in Unknown on line 0
edit: but i can very well see the file in the directory.

Posted: Sat Oct 07, 2006 6:34 am
by volka
The file sqlite.dll (not php_sqlite.dll) has to be copied somewhere windows can find it for the process that runs php.
Try the apache bin directory or D:\Windows

Posted: Sat Oct 07, 2006 6:44 am
by raghavan20
i dont have any sqlite.dll file but i have only php_sqlite.dll file which is the file name mentioned in the php.ini file as well.

Posted: Sat Oct 07, 2006 6:46 am
by raghavan20
i have even created the copy of the file as sqlite.dll in c:/www/php/ext and i have also a copy of it d:/windows but nothing seems to work.

Posted: Sat Oct 07, 2006 6:49 am
by volka
No. There has to be a file called sqlite.dll. It's not php_sqlite.dll renamed. It's the actual sqlite library and php_sqlite.dll depends on it.
Where did you get your copy of php?

Posted: Sat Oct 07, 2006 8:42 am
by Litewebsite
Which version of PHP are you running? Have you tried setting the extension path in php.ini to: extension_dir = "./ext" ?

I could also recommend using the PDO extension when working with SQLite. This extension will let you work with SQLite version 3 instead of 2. And if you in the future need to switch from SQLite to MySQL or vice versa PDO will make this easy for you.

Posted: Sun Oct 08, 2006 5:40 am
by raghavan20
Litewebsite wrote:Which version of PHP are you running? Have you tried setting the extension path in php.ini to: extension_dir = "./ext" ?

I could also recommend using the PDO extension when working with SQLite. This extension will let you work with SQLite version 3 instead of 2. And if you in the future need to switch from SQLite to MySQL or vice versa PDO will make this easy for you.
i was trying another XP co installation in my local system and the sqlite worked only when i enabled pdo extension and it looks like sqlite extension requires pdo extension.

can any of you explain me of the dependency factor?

Thanks for all your help guys.

Posted: Sun Oct 08, 2006 6:11 am
by Litewebsite
raghavan20 wrote:... i was trying another XP co installation in my local system and the sqlite worked only when i enabled pdo extension and it looks like sqlite extension requires pdo extension. can any of you explain me of the dependency factor? ...
I just found a thread on php.net about PDO SQLite dependency on Windows.

Happy coding!

Posted: Sun Oct 08, 2006 6:29 am
by raghavan20
Litewebsite wrote:
raghavan20 wrote:... i was trying another XP co installation in my local system and the sqlite worked only when i enabled pdo extension and it looks like sqlite extension requires pdo extension. can any of you explain me of the dependency factor? ...
I just found a thread on php.net about PDO SQLite dependency on Windows.

Happy coding!
thanks for bringing that into light!
it is often pathetic to see basic things do not work as they meant to be and not documented properly!

edit: i have similar add module problem in apache for my new installation...it is here
viewtopic.php?t=56739&highlight=

Posted: Sun Oct 08, 2006 9:56 am
by MarK (CZ)
I have similar problem with MySQL but I can't get it working even when I load the PDO dll first. Any suggestions?

Posted: Sun Oct 08, 2006 2:07 pm
by raghavan20
what exactly is the error you get?
are you trying to use either mysql or mysqli?

Posted: Sun Oct 08, 2006 2:19 pm
by volka
:oops: the php/sqlite build of xampp differs from php.net and sqlite.dll ships with xampp (the way it should be) but not with the pacakges from php.net.

Anyway, the manual says about mysql+php5 on win32
http://de2.php.net/mysql wrote:Installation on Windows Systems
[...]
PHP 5+

MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext

Note: If when starting the web server an error similar to the following occurs: "Unable to load dynamic library './php_mysql.dll'", this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.
And that's how it should be with php_sqlite.dll<->(lib)sqlite.dll, too. But obviously it isn't by default. Sorry again for that.

Posted: Sun Oct 08, 2006 4:25 pm
by MarK (CZ)
Apache - installed by installer
PHP - installed from zip
MySQL - installed by installer

phpMyAdmin reports:
Cannot load mysql extension. Please check your PHP configuration.
Documentation says:
[1.20] I receive the error "cannot load MySQL extension, please check PHP Configuration".

To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension". This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed.

Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar.
php.ini, extensions:
extension=php_pdo.dll
extension=php_mysql.dll
Apache error log:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Apache2\\php\\ext\\php_mysql.dll' - Uveden\xfd modul nebyl nalezen.\r\n in Unknown on line 0
(that means specified module has not been found)

But the module is there. All other module inclusions work.