我在Window 7上设置了PHP5.3,MySQL5.1和IIS7,但php不想使用MySQL。我假设这是配置错误或我不完整的安装。
过去我记得将一个文件libmysql.dll移动到System32,但我看起来并不像php5.3.1,因为驱动程序现在内置http://us3.php.net/manual/en/mysqlnd.install.php。
(这给我带来了很多麻烦,我一直在我的博客上记录我的发现http://inteldesigner.com/2010/code/having-problems-getting-php5-3-to-work-with-mysql5-1)
需要:
任何链接或建议都会很棒,我已经在iis网站上做了一切,没有任何工作。我猜他们没有更新新软件。
BUGS /溶液:
解决方案就在这里:http://bugs.php.net/bug.php?id=50172感谢在iis.net论坛上发表don.raman http://forums.iis.net/p/1164911/1933894.aspx
症状:
php函数mysql_connect()
与php5.3一起锁定服务器并返回错误500.(IPv6是问题见上面的链接)
测试代码:
<?php
$con = mysql_connect("localhost","root","***");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_close($con);
?>
错误:
来自浏览器:
HTTP Error 500.0 - Internal Server Error
C:\php\php-cgi.exe - The FastCGI process exceeded configured activity timeout
当我从命令行运行php -f c:\public_html\index.php
时,我得到了:
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>
答案 0 :(得分:1)
don.raman写道:
请查看http://bugs.php.net/bug.php?id=50172以获得解决方案。
另一种方法是使用PHP 5.2.12,它没有这种行为。
答案 1 :(得分:0)
我在Windows 7 / Apache / MySql中遇到了my_sql_connect错误。 将主机参数从“localhost”更改为“127.0.0.1”也对我有用。
对于其他主机,只需使用IP地址而不是主机名(如果要快速查找其IP地址,请在命令提示符下键入“ping”)。
答案 2 :(得分:-1)
这样做:
C://Windows/System32/drivers/etc
host
在您执行任何操作之前,请确保您具有足够的权限进行编辑,右键单击它转到PROPERTIES-&gt; SECURITY-&gt; EDIT然后选择您正在使用的用户帐户并通过单击Full来完全控制它控制复选框,然后按 - > - 确定
使用记事本或任何其他ANSI标准文本编辑器打开host
文件,并通过删除# 127.0.0.1 localhost
取消注释行#
并保存。