Solved

PHP/MySQL 5.1 Server Connection problem

Posted on 2013-10-22
11
408 Views
Last Modified: 2013-10-22
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.
0
Comment
Question by:VDOGamer
  • 6
  • 5
11 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592072
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.
0
 

Author Comment

by:VDOGamer
ID: 39592127
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.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592400
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.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:VDOGamer
ID: 39592514
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
0
 

Author Comment

by:VDOGamer
ID: 39592518
I didn't use the WAMP installation package.  I installed Apache, MySQL, PHP, then phpMyAdmin.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39592603
I would have recommended the WAMP or XAMPP packages because they do all the set up for you.  Installing them separately means that you have to do the set up that is required.  If you decide to go back and use WAMP or XAMPP, you will need to completely uninstall Apache, MySQL, and PHP so there won't be any conflicts.
0
 

Author Comment

by:VDOGamer
ID: 39592634
Okay.  Do I have to enable Apache, MySQL, and PHP access through the firewall?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592675
You will if you want to access them remotely or by the machine's IP address.  Is phpMyAdmin currently working on your machine?
0
 

Author Comment

by:VDOGamer
ID: 39592686
Yes it is.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592752
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")
0
 

Author Comment

by:VDOGamer
ID: 39592993
Switching to the WAMP installation package now.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question