I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here.
我已经更新了php.ini并移动了php_mysql.dll,如步骤6和8中所述。
I get this error…
我收到这个错误......
Fatal error: Call to undefined function mysql_connect() in C:\inetpub...
MySQL doesn't show up in my phpinfo; report.
MySQL没有出现在我的phpinfo中;报告。
I've updated the c:\Windows\php.ini file from
我已经更新了c:\ Windows \ php.ini文件
; Directory in which the loadable extensions (modules) reside. extension_dir = "./"
to
; Directory in which the loadable extensions (modules) reside. extension_dir = ".;c:\Windows\System32"
Result: no change.
结果:没有变化。
I changed the php.ini value of extension_dir thusly:
我因此改变了extension_dir的php.ini值:
extension_dir = "C:\Windows\System32"
Result: much more in the phpinfo; report, but MySQL still isn't working.
结果:phpinfo更多;报告,但MySQL仍然无法正常工作。
I copied the file libmysql.dll from folder C:\php to folders C:\Windows\System32 and C:\Windows
我将文件libmysql.dll从文件夹C:\ php复制到文件夹C:\ Windows \ System32和C:\ Windows
Result: no change.
结果:没有变化。
I stopped and restarted IIS.
我停下来重新启动IIS。
Result: new, different errors instead!
结果:新的,不同的错误!
Warning: mysql_connect() [function.mysql-connect]: Access denied for user '...'@'localhost' (using password: YES) in C:\inetpub\... error in query.
Fatal error: Call to a member function RecordCount() on a non-object in C:\inetpub\...
I found several .php files in the website where I had to set variables:
我在网站上找到了几个.php文件,我必须设置变量:
$db_user $db_pass
Result: The site works!
结果:网站有效!
4 个解决方案
#1
5
As the others say these two values in php.ini are crucial.
正如其他人所说,php.ini中的这两个值是至关重要的。
I have the following in my php.ini: note the trailing slash - not sure if it is needed - but it does work.
我在php.ini中有以下内容:注意尾随斜杠 - 不确定是否需要 - 但它确实有效。
extension_dir = "H:\apps\php\ext\"
extension=php_mysql.dll
Also it is worth ensuring that you only have one copy of php.ini on your machine - I've had problems with this where I've been editting a php.ini file which php isn't using and getting very frustrated until I realised.
还有一点值得确保你的机器上只有一个php.ini的副本 - 我遇到过这个问题,我一直在编辑一个php.ini文件,php没有使用这个文件并且在我意识到之前变得非常沮丧。
Also if php is running as a module within apache you will need to restart the apache server to pickup the changes. Wise to do this in anycase if you're not sure.
此外,如果php作为apache中的模块运行,则需要重新启动apache服务器以获取更改。如果你不确定的话,明智地做任何事情。
a "php -m" from the cmd prompt will show you the modules that are loaded from the ini file.
cmd提示符下的“php -m”将显示从ini文件加载的模块。
#2
1
In the php.ini file, check if the extention path configuration is valid.
在php.ini文件中,检查扩展路径配置是否有效。
#3
1
You will need to enable the extension=php_mysql.dll option in the php.ini as well. Also, make sure that the file is in the extension_dir you set.
您还需要在php.ini中启用extension = php_mysql.dll选项。此外,请确保该文件位于您设置的extension_dir中。
You can read more about it at:
您可以在以下位置了解更多信息:
#4
1
On a completely different note, might I suggest WampServer? It should get you up and running with a Apache/PHP/MySQL install in no time.
在一个完全不同的说明,我可以建议WampServer?它应该让您立即启动并运行Apache / PHP / MySQL安装。
You could even compare the WampServer config files with your own to see where you originally went wrong.
您甚至可以将WampServer配置文件与您自己的配置文件进行比较,以查看您最初出错的位置。
#1
5
As the others say these two values in php.ini are crucial.
正如其他人所说,php.ini中的这两个值是至关重要的。
I have the following in my php.ini: note the trailing slash - not sure if it is needed - but it does work.
我在php.ini中有以下内容:注意尾随斜杠 - 不确定是否需要 - 但它确实有效。
extension_dir = "H:\apps\php\ext\"
extension=php_mysql.dll
Also it is worth ensuring that you only have one copy of php.ini on your machine - I've had problems with this where I've been editting a php.ini file which php isn't using and getting very frustrated until I realised.
还有一点值得确保你的机器上只有一个php.ini的副本 - 我遇到过这个问题,我一直在编辑一个php.ini文件,php没有使用这个文件并且在我意识到之前变得非常沮丧。
Also if php is running as a module within apache you will need to restart the apache server to pickup the changes. Wise to do this in anycase if you're not sure.
此外,如果php作为apache中的模块运行,则需要重新启动apache服务器以获取更改。如果你不确定的话,明智地做任何事情。
a "php -m" from the cmd prompt will show you the modules that are loaded from the ini file.
cmd提示符下的“php -m”将显示从ini文件加载的模块。
#2
1
In the php.ini file, check if the extention path configuration is valid.
在php.ini文件中,检查扩展路径配置是否有效。
#3
1
You will need to enable the extension=php_mysql.dll option in the php.ini as well. Also, make sure that the file is in the extension_dir you set.
您还需要在php.ini中启用extension = php_mysql.dll选项。此外,请确保该文件位于您设置的extension_dir中。
You can read more about it at:
您可以在以下位置了解更多信息:
#4
1
On a completely different note, might I suggest WampServer? It should get you up and running with a Apache/PHP/MySQL install in no time.
在一个完全不同的说明,我可以建议WampServer?它应该让您立即启动并运行Apache / PHP / MySQL安装。
You could even compare the WampServer config files with your own to see where you originally went wrong.
您甚至可以将WampServer配置文件与您自己的配置文件进行比较,以查看您最初出错的位置。