Connection Issues: Apache, PHP, MySQL

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
RodS1967
Forum Newbie
Posts: 5
Joined: Fri Nov 20, 2009 11:29 am

Connection Issues: Apache, PHP, MySQL

Post by RodS1967 »

I am using mysql-5.1.41-win32, php-5.3.0-Win32-VC9-x86, and apache_2.2.14-win32-x86-no_ssl and I am having trouble connecting to my database using PHP. I have no problem with Apache in regards to running htm or php files and can issue the

Code: Select all

phpinfo();
command without issue, but when I try to issue

Code: Select all

mysql_connect($db_server, $db_user, $db_password) or die ( "<H3>Server unreachable</H3>");
it restarts my Apache server with the following error in the log file: [notice] Parent: child process exited with status 3221225477 -- Restarting.

I have looked up this error and the popular resolution seems to be to copy libmysql.dll all over the place. I have the directory that is in in my path, so I don't think that is the issue, but to make sure I did copy it to all applicable areas: System32, PHP bin, Apache bin. I have also made the MySql/bin directory the first one in my path as recommended by another poster here. My connection still fails and causes the Apache server to restart.

I also have several unrelated failures in my log file when Apache restarts:

[Fri Nov 20 12:02:23 2009] [notice] Parent: child process exited with status 3221225477 -- Restarting.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0 [Fri Nov 20 12:02:24 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Fri Nov 20 12:02:24 2009] [notice] Server built: Sep 28 2009 22:41:08 [Fri Nov 20 12:02:24 2009] [notice] Parent: Created child process 1860 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0 [Fri Nov 20 12:02:24 2009] [notice] Child 1860: Child process is running [Fri Nov 20 12:02:24 2009] [notice] Child 1860: Acquired the start mutex.
[Fri Nov 20 12:02:24 2009] [notice] Child 1860: Starting 64 worker threads.
[Fri Nov 20 12:02:24 2009] [notice] Child 1860: Starting thread to listen on port 80.

Any ideas?
RodS1967
Forum Newbie
Posts: 5
Joined: Fri Nov 20, 2009 11:29 am

Re: Connection Issues: Apache, PHP, MySQL

Post by RodS1967 »

Just found this in my event viewer too:
Faulting application httpd.exe, version 2.2.14.0, faulting module php_mysql.dll, version 5.3.0.0, fault address 0x0000216d.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Connection Issues: Apache, PHP, MySQL

Post by califdon »

If MySQL server has started, you should be able to login manually from cmd.exe:

Code: Select all

C:\WINDOWS\System32> mysql -hlocalhost -uroot -p[your mysql password]
And of course the usual, check Task Manager to see that httpd and mysqld processes are running, but it sounds like you've already got that pinned down.

Have you looked at the Apache configuration file closely? That's httpd.config and there are several lines that are often commented out in the default configuration file or contain the wrong paths or filenames for your particular installation. It's a tedious process, but that's the first thing I would do.

Other than that, it could be a corrupted installation. It wouldn't take very long to uninstall Apache and/or MySQL and reinstall them.
RodS1967
Forum Newbie
Posts: 5
Joined: Fri Nov 20, 2009 11:29 am

Re: Connection Issues: Apache, PHP, MySQL

Post by RodS1967 »

Yep, I've tested connectivity to MySql already and that is fine except via PHP. I uninstalled Apache, PHP, and MySql and reinstalled them to no avail. A colleague of mine and I went over the config file and couldn't find anything wrong with it. Like I said, it is only when I try to connect to the MySql database that Apache has any issues. I can run common PHP commands and there are no issues. I have also done a quick test of connecting to an Oracle instance on another box and that was successful. I am in the process of putting MySql on another box and see if I still have issues when connecting to a remote MySql instance.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Connection Issues: Apache, PHP, MySQL

Post by califdon »

This sounds like an installation/configuration issue. I will move this to the Installation and Configuration forum in the hope that someone will see it there and be able to give you some better advice.
RodS1967
Forum Newbie
Posts: 5
Joined: Fri Nov 20, 2009 11:29 am

Re: Connection Issues: Apache, PHP, MySQL

Post by RodS1967 »

Agreed. Thanks.
RodS1967
Forum Newbie
Posts: 5
Joined: Fri Nov 20, 2009 11:29 am

Re: Connection Issues: Apache, PHP, MySQL

Post by RodS1967 »

Another interesting nuance of this issue.

If I give bad login parameters (e.g. invalid user name), the connection fails and returns the expected "Access denied for user 'user_name'@'localhost' (using password: YES)". It is only when correct values are passed in that Apache restarts.

And it does not make a difference whether MySql is being accessed at localhost or if it is on a remote machine.
Post Reply