Solved

PHP/MySQL 5.1 Server Connection problem

Posted on 2013-10-22
11
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 

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

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.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

634 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