Jump to content
  • Advertisement
Sign in to follow this  
Evil Steve

[web] Installing PHP + MySQL on Apache

This topic is 5161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
php_mysql.dll is correct according to the docs:
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

Share this post


Link to post
Share on other sites
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 :(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Ah... Now I'm getting somwhere. Its not reading the php.ini file at all. I changed some settings and restarted apache, and phpinfo() didn't say they'd changed.

My php.ini is in C:\WINNT\, isn't that right?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!