Jump to content

PHP can't communicate with mySQL


abdfahim

Recommended Posts

Hi,

 

I have been using same php.ini and httpd.conf file for long. I have used the same 32-bit APACHE+PHP+MYSQL in my newly bought laptop with a new 64bit Windows 7 (previously I used 32-bit Vista). As a result, all 3 software installed in "Program Files (x86)" folder.

 

I have managed to make Apache+PHP working. Also, 32-bit mySQL is also working (I can run query from command prompt).

 

Only problem is any php can't communicate with mysql. Solution plz. I never worked in 64bit environment before.

 

btw, phpmyadmin is showing error

Cannot load mysql extension. Please check your PHP configuration

Link to comment
Share on other sites

hello experts, i am still facing the same prob ... I have uninstall and reinstall the MySQL, but still same problem.

 

Plz help. Btw, I have my PHP working. Also, MySQL is working individually (from command prompt). Just cant load the extension (though uncommented)

Link to comment
Share on other sites

You need to make sure that the php.ini that you are changing is the one that php is using. Create a .php file with <?php phpinfo(); ?> in it and browse to it. The Loaded Configuration File value is the php.ini that php is using.

 

Once you get php to use the php.ini that you are changing, you need to set the php.ini  extension_dir setting to point to the folder where the extension .dlls are at. You also need to check that the actual .dll files are present (in programming you cannot assume that something is the same as what you did before, you must check and confirm that it is the same.)

 

Have you checked your web server error log file to see what sort of startup errors are occurring for the mysql/mysqli dll's?

 

Beyond getting all the pieces in the right place, problems loading extensions are usually due to file system user permissions. Do all the files (httpd.conf, php.ini, dll's) and folders have permissions set so that the user that apache is running under can access them?

Link to comment
Share on other sites

Hi,

 

Thanks for details. Some of those I have already checked, some not. Plz find here the responses

 

1) Loaded Configuration File is C:\php\php.ini - same as my intended file.

2) I have extension_dir = "c:\php\ext"

3) Also, in php.ini, i have

extension=php_mysql.dll
extension=php_mysqli.dll

4) Both the files are present in C:\php\ext directory (rechecked)

 

Now here is some new checks

5) in error.log in apache server, I haven't find any error listed against mysql

6) Now, this one might be the problem. Because I am very new to WIndows 7 64 bit, also I have installed 32-bit version of MySQL I am suspecting some problem like this. Can you please describe how to check this?

 

Thanks,

-Abd

Link to comment
Share on other sites

Does the phpinfo() output show a mysql and/or mysqli section?

 

I thought you stated you installed the three pieces into the 'program files' folder? What is the php.ini and the ext folder doing in c:/php ?

 

The mysql server is a service. Php connects to it on Windows using a TCP/IP connection. As long as the mysql server is running and can be connected to it does not matter what the underlying architecture is.

Link to comment
Share on other sites

Since there are no startup errors concerning loading the .dll's, it is most likely that php cannot read the php.ini or it cannot see the two lines that should be loading the mysql/mysqli .dll's

 

I'm going to guess that either when you edited php.ini it got saved as php.ini.txt and you have file extensions hidden or you have a syntax error in your php.ini that is preventing the two lines from being seen as valid settings (does changing any other setting in the php.ini affect the phpinfo() output) or you have a file/folder permission problem and php cannot read the php.ini.

Link to comment
Share on other sites

thanks to you I have solved it ! As you said, I might have some problem in php.ini, so I replace that with my backed up one. And, it starts working!!

 

But, a strange thing I found that, all this problem is happening whenever I change the following line in php.ini

doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

 

to this one

doc_root = C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs

 

!!! This is strange. Because my doc root is actually the later one !!!

 

Rather there is no such directory existing like the 1st one ...

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.