Jump to content

php cannot connect with mysql


Recommended Posts

hey guys

first i would like to tell u something about myself and my comp,

i am on windows 7 x64, and i am a php coder, and i am ready to do anything for my below issue..

 

1) i downloaded and installed apache from apache.org and its working like a charm.

2) i downloaded the complete x64 mysql installer from here, and installed, no error nothing. that tooo works like charm.

3) i downloaded and installed php vc6 safe thread zip and configured apache to work with it..

now that too works like a charm.

 

now the issue,

i enabled mysql.dll and mysqli.dll in php.ini and checked in phpinfo() and i can see both the extenstions are enabled.

 

so i made a short test script like

mysql_connect("localhost", "root", "******") or die(mysql_error());

echo("it works");

and i ran it, i get a blank white screen after many seconds..

then i ran phpmyadmin, and tried to log in into it, same error.

i verified the mysql server is running, and i tried to log into it using console and passed.

 

so can anyone tell me what is the issue?

 

i did one check myself, i turned off mysql server manually, and re-ran both, myscript and phpmyadmin, same error, so my best guess is php cannot communicate with mysql..

 

can u pleaes please help me, i need this badly

 

Link to comment
Share on other sites

  • 4 weeks later...

I just encountered this problem myself. Also, no one responded to my post either, but I was able to resolve it.

 

The problem is that the newer versions of PHP went dumb and can't figure out that "localhost" equals "127.0.0.1".

 

Use 127.0.0.1 instead of localhost and you will have no problems (providing the correct credentials, server is started, etc etc.)

 

Cheers.

 

(ps: hope they stop "fixing" shit that ain't broke over at the php dev crew, and maybe release proper instructions on how to compile under windows and provide ALL the libraries included necessary to compile in the source they distro rather than leaving it up to people to randomly figure out (hopelessly) where they go).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.