I have set up PHP5.3, MySQL5.1, and IIS7 on Window 7 but php doesn't want to work with MySQL. I'm assuming it is a configuration error or an incomplete install on my part.
- MySQL5.1 is working
- PHP5.3 is working, phpinfo() shows info and that i have enabled MySQL
- IIS is setup and using fastCgiModule to run PHP
- IIS registers php.ini updates
- port 3306 is firewall free and open to the world
- php.ini is configured correctly
- I have added c:\php to the Windows systems PATH
In the past I remember moving a file, libmysql.dll, to System32 but I doesn't look like that come with php5.3.1, as the driver comes built in now http://us3.php.net/manual/en/mysqlnd.install.php.
(This has been giving me so much trouble I have been documenting my findings on my blog as http://inteldesigner.com/2010/code/having-problems-getting-php5-3-to-work-with-mysql5-1 )
NEED:
- I need to install PHP manually, don't want to use the quick installer or an older version
- I need to get PHP5.3 to work with MySQL5.1 so i can install Wordpress2.9 and Drupal7a
Any links or suggestion would be great, I have already done everything on the iis web site, nothing is working. I'm guessing they have not updated for new software.
BUGS/SOLU开发者_如何学CTION:
The solution is here: http://bugs.php.net/bug.php?id=50172 thanks go to don.raman on the iis.net forums http://forums.iis.net/p/1164911/1933894.aspx
SYMPTOMS:
The php function mysql_connect()
in conjunction with php5.3 locks up sever and returns error 500. (IPv6 is the problem see above link)
TEST CODE:
<?php
$con = mysql_connect("localhost","root","***");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_close($con);
?>
ERRORS:
From Browser:
HTTP Error 500.0 - Internal Server Error
C:\php\php-cgi.exe - The FastCGI process exceeded configured activity timeout
When i run php -f c:\public_html\index.php
from the command line i got:
PHP Warning: mysql_connect(): [2002] A connection attempt failed because the co
nnected party did not (trying to connect via tcp://localhost:3306) in C:\public
_html\index.php on line 10
Warning: mysql_connect(): [2002] A connection attempt failed because the connect
ed party did not (trying to connect via tcp://localhost:3306) in C:\public_html
\index.php on line 10
PHP Warning: mysql_connect(): A connection attempt failed because the connected
party did not properly respond after a period of time, or established connectio
n failed because connected host has failed to respond.
in C:\public_html\index.php on line 10
Warning: mysql_connect(): A connection attempt failed because the connected part
y did not properly respond after a period of time, or established connection fai
led because connected host has failed to respond.
in C:\public_html\index.php on line 10
Could not connect: A connection attempt failed because the connected party did n
ot properly respond after a period of time, or established connection failed bec
ause connected host has failed to respond.
C:\Users\Kevin>
don.raman wrote:
Please look at http://bugs.php.net/bug.php?id=50172 for resolution on this.
Another alternative is to to use PHP 5.2.12 which doesn't have this behavior.
I found it http://forums.iis.net/p/1164911/1933894.aspx and posted about it.
I had the my_sql_connect error with Windows 7/Apache/MySql. Changing host parameter from 'localhost' to '127.0.0.1' also worked for me.
Also for other hosts just use the IP address instead of the host name (type 'ping ' from a command prompt if you want to find its IP address quickly).
Do this:
- Go to
C://Windows/System32/drivers/etc
- Edit the file called
host
Before you do anything make sure you have enough permissions to edit it, right click on it Go to PROPERTIES->SECURITY->EDIT then choose the user account you are using and give full control to it by clicking on Full Control check box, then Apply->Ok
Open host
file using notepad or any other ANSI standard text editor and uncomment the line # 127.0.0.1 localhost
by removing #
and save.
精彩评论