Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP/MySQL 5.1 Server Connection problem

Posted on 2013-10-22
11
Medium Priority
?
418 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 84

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 84

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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

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 84

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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

885 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