[web] Installing PHP + MySQL on Apache
Hey all, I'm trying to install Apache on Windows 2000. I've got Apache 2.0.50 set up fine, and I've got MySQL 4.0.20 installed. But, I can't get PHP to cooperate with MySQL. I've got PHP 5.0.1 working, but I get "Fatal error: Call to undefined function mysql_connect() in D:\www\test.php on line 2". So, I'm assuming that means that PHP isn't working with MySQL. I've heard that they changed PHP so it doesn't automatically load the MySQL extension at some point, but what do I need to do to get it to load it?
I had a look at my php.ini, and I tried adding "extension=mysql.dll", "extension=php_mysql.dll", "extension=libmysql.dll" and "extension=libmysqli.dll" (at different times), and restarting apache between tests, but I still get the "call to undefined function" error.
So, does anyone know what the correct extension name is? Theres "libsql.dll" and "libsqli.dll" files in my php install dir.
I'm using a prebuilt PHP version (the zip version).
Cheers,
Steve
php_mysql.dll is correct according to the docs:
So... find that dll and make sure windows can find it. And find the libmySQL.dll and put that somewhere windows can find it, too.
John B
Quote:In PHP 5, MySQL is no longer enabled by default, nor is the MySQL library bundled with PHP. Read this FAQ for details on why. Because of this, Windows users will need to enable php_mysql.dll inside of php.ini and either copy libmysql.dll into the Windows system directory or make it available to the PATH. For compiling, simply use --with-mysql=[DIR] where [DIR] points to your MySQL installation directory.
So... find that dll and make sure windows can find it. And find the libmySQL.dll and put that somewhere windows can find it, too.
John B
Hmm... Tried that - no luck. I've tried moving libmysql.dll into my apache /bin directory, C:\WINNT and C:\WINNT\System32. All without any luck :(
Quote:Original post by Evil Steve
Hey all, I'm trying to install Apache on Windows 2000. I've got Apache 2.0.50 set up fine, and I've got MySQL 4.0.20 installed. But, I can't get PHP to cooperate with MySQL. I've got PHP 5.0.1 working, but I get "Fatal error: Call to undefined function mysql_connect() in D:\www\test.php on line 2". So, I'm assuming that means that PHP isn't working with MySQL. I've heard that they changed PHP so it doesn't automatically load the MySQL extension at some point, but what do I need to do to get it to load it?
I had a look at my php.ini, and I tried adding "extension=mysql.dll", "extension=php_mysql.dll", "extension=libmysql.dll" and "extension=libmysqli.dll" (at different times), and restarting apache between tests, but I still get the "call to undefined function" error.
So, does anyone know what the correct extension name is? Theres "libsql.dll" and "libsqli.dll" files in my php install dir.
I'm using a prebuilt PHP version (the zip version).
Cheers,
Steve
Did you include the correct files for the php5 install? The php files that need to be included have changed in php5. Refer to the php installation manual that came with your download for specifics, because sorry, I don't remember the specifc files. perhaps php5ts.dll or something like that? php4apache2.dll?
Also, I think the issues have been resolved but there were problems with the latest Apache + PHP. You might want to take that into consideration too.
Quote:Original post by Charles Hwang
Did you include the correct files for the php5 install? The php files that need to be included have changed in php5. Refer to the php installation manual that came with your download for specifics, because sorry, I don't remember the specifc files. perhaps php5ts.dll or something like that? php4apache2.dll?
Yep - its php5apache2.dll, and its an added module to Apache.
PHP itself works fine, but it won't use the MySQL functions...
I just did this myself last weekend.
Easiest way to do it is to add the paths to your PHP installation, your MySQL installation, and your Apache2\bin to your PATH environment variable. Then restart Apache if it's already running. That should do the trick.
Alternatively, I think if you actually copy the libmysql.dll and libmysqli.dll files into Apache's bin directory, restart Apache, that will work.
To be honest, even though I've set it up, I haven't actually tried making a mysql call in a PHP page via Apache yet, so it could be that it's not working for me yet either.
I'll try it out later tonight at home; you'll probably have it going by then anyways though.
- dorix
edit: Gah, there was only one reply when I started writing this.
Easiest way to do it is to add the paths to your PHP installation, your MySQL installation, and your Apache2\bin to your PATH environment variable. Then restart Apache if it's already running. That should do the trick.
Alternatively, I think if you actually copy the libmysql.dll and libmysqli.dll files into Apache's bin directory, restart Apache, that will work.
To be honest, even though I've set it up, I haven't actually tried making a mysql call in a PHP page via Apache yet, so it could be that it's not working for me yet either.
I'll try it out later tonight at home; you'll probably have it going by then anyways though.
- dorix
edit: Gah, there was only one reply when I started writing this.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement