我已经在 Window 7 上设置了 PHP5.3、MySQL5.1 和 IIS7,但 php 不想使用 MySQL。我假设这是我的配置错误或安装不完整。
- MySQL5.1 正在运行
- PHP5.3 正在工作,phpinfo() 显示信息并且我已启用 MySQL
- IIS 已设置并使用 fastCgiModule 运行 PHP
- IIS 注册 php.ini 更新
- 端口 3306 没有防火墙,对世界开放
- php.ini 配置正确
- 我已将 c:\php 添加到 Windows 系统 PATH
过去我记得将文件 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 )
需要:
- 我需要手动安装 PHP,不想使用快速安装程序或旧版本
- 我需要让 PHP5.3 与 MySQL5.1 一起工作,这样我才能安装 Wordpress2.9 和 Drupal7a
任何链接或建议都会很棒,我已经在 iis 网站上做了所有事情,没有任何效果。我猜他们还没有更新新软件。
错误/解决方案:
解决方案在这里:http : //bugs.php.net/bug.php?id=50172 感谢 iis.net 论坛http://forums.iis.net/p/1164911/1933894 上的 don.raman。 aspx
症状:
mysql_connect()
php5.3结合php函数锁定服务器并返回错误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>