apache 加载 PHP 模块时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/476793/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error loading PHP modules
提问by moo
I'm running PHP 5.2.8 on Apache 2.2.11 on Windows XP SP 3. In php.ini,
我在 Windows XP SP 3 上的 Apache 2.2.11 上运行 PHP 5.2.8。在 php.ini 中,
extension_dir = "C:\Program Files\PHP\ext"
extension=php_mysql.dll
In error.log:
在错误日志中:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
php_mysql.dll is definately located in the extension_dir, and is the version that PHP 5.2.8 is bundled with. What's up?
php_mysql.dll 肯定位于 extension_dir 中,并且是 PHP 5.2.8 捆绑的版本。这是怎么回事?
回答by Ross
Try adding a trailing slashto your extension_dirpath.
尝试在您的路径中添加一个尾部斜杠extension_dir。
This is what I am using in my WAMP setup:
这是我在 WAMP 设置中使用的内容:
extension_dir = "D:\php\ext\"
; ...snip...
extension=php_gd2.dll
回答by DavidM
You need to make the MySQL client library available to PHP. This is done by copying the libmysql.dll file from the PHP package root directory into a directory on your system within the Windows PATH.
您需要使 PHP 可以使用 MySQL 客户端库。这是通过将 libmysql.dll 文件从 PHP 包根目录复制到系统上 Windows PATH 中的目录来完成的。
The quickest way to do this is to copy libmysql.dll into your C:\Windows\System directory but as noted in the manual, this is not recommended and is just a quick fix to see if it is actually the problem here.
执行此操作的最快方法是将 libmysql.dll 复制到您的 C:\Windows\System 目录中,但如手册中所述,不推荐这样做,这只是一个快速修复,以查看是否确实是此处的问题。
http://us2.php.net/manual/en/mysql.installation.phpsays:
http://us2.php.net/manual/en/mysql.installation.php说:
MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.
MySQL 不再默认启用,因此必须在 php.ini 中启用 php_mysql.dll DLL。此外,PHP 需要访问 MySQL 客户端库。一个名为 libmysql.dll 的文件包含在 Windows PHP 发行版中,为了让 PHP 与 MySQL 对话,该文件需要可用于 Windows 系统路径。有关如何执行此操作的信息,请参阅标题为“如何将我的 PHP 目录添加到 Windows 上的 PATH”的常见问题解答。尽管将 libmysql.dll 复制到 Windows 系统目录也可以(因为系统目录默认在系统的 PATH 中),但不建议这样做。
The best option is to add the PHP directory into your Windows PATH, which is explained in this FAQ.
回答by Erik
You could try
你可以试试
extension_dir = "C:/Program Files/PHP/ext"
extension_dir = "C:/Program Files/PHP/ext"
Edit: No, not that. Seems you need to add it to the PATH variable in Windows: http://us2.php.net/manual/en/install.windows.iis.php
编辑:不,不是那个。似乎您需要将其添加到 Windows 中的 PATH 变量中:http: //us2.php.net/manual/en/install.windows.iis.php

