Link to home
Start Free TrialLog in
Avatar of VDOGamer
VDOGamer

asked on

PHP/MySQL 5.1 Server Connection problem

Hello.  I'm running WAMP, MySQL & Apache Server services are started.  I created a folder on the desktop to place the ".AMP" installation information.  I created a MySQL user with the appropriate permissions.  However, when I run the mysql_connect("localhost", "user", "password") or die( "foo" ), I get the server connection error.  

What am I missing?

Thanks,

Cameron.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Details needed because it is probably a detail that is causing the issue.  What OS are you running?  Do you have IIS running?  Is it a 64-bit machine?  64-bit machines sometimes define 'localhost' as '::1' which is the IPV6 version.  MySQL wants to see '127.0.0.1' which is the IPV4 version.
Avatar of VDOGamer
VDOGamer

ASKER

Sorry about that.  I'm running win7 64 and I do have IIS 6 running.  I stopped IIS 6, but the problem is the same.
You may have to un-install IIS to get WAMP's Apache to work on port 80.  Or put Apache on another port like 8080.  Try using mysql_connect("127.0.0.1", "user", "password") .  You can look in Task Manager to see if 'mysqld', the MySQL daemon, is running.  If not, go to the WAMP control Icon in the task bar and start it.
Okay.  IIS was uninstalled and I used the mysql_connect("127.0.0.1:8080", "user", "password")
mysqld is running.
...now something is running.......forever
I didn't use the WAMP installation package.  I installed Apache, MySQL, PHP, then phpMyAdmin.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay.  Do I have to enable Apache, MySQL, and PHP access through the firewall?
You will if you want to access them remotely or by the machine's IP address.  Is phpMyAdmin currently working on your machine?
Yes it is.
Then PHP and Apache are working.  I don't know why your connection 'runs forever'.  Except that... MySQL is on port 3306.

mysql_connect("127.0.0.1:3306", "user", "password")
Switching to the WAMP installation package now.