PHP 启动:无法加载动态库、Windows、Apache 2.2、php 5.2.11

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1808442/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:54:52  来源:igfitidea点击:

PHP Startup: Unable to load dynamic library, Windows, Apache 2.2, php 5.2.11

phpwindowsapache

提问by Scott Bonner

This is becoming a very frustrating issue. I am trying to do a clean install of apache 2.2 and PHP 5.2.11. Everything seems to be configured correctly but the php modules aren't starting...

这正在成为一个非常令人沮丧的问题。我正在尝试全新安装 apache 2.2 和 PHP 5.2.11。一切似乎都配置正确,但 php 模块没有启动......

PHP Warning:  PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0

in the php.ini

在 php.ini

include_path = ".;C:\Program Files (x86)\Apache Software Foundation\Apache2.2\php"
extension_dir = ".;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"

All the files are there... The .dll files such as ssleay32.dll, libmcrypt.dll, libmysql.dll, libeay32.dll are all installed at...

所有文件都在那里... ssleay32.dll、libmcrypt.dll、libmysql.dll、libeay32.dll等.dll文件都安装在...

C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/

C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/

I also included them in the C:\Windows\System32

我还将它们包含在 C:\Windows\System32

and even added C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ to the windows path.

甚至将 C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ 添加到 windows 路径。

I have no idea why this isn't working and it feels like a no win situation. Anyone have any ideas on how to get this all working ok?

我不知道为什么这不起作用,感觉就像一个没有胜利的情况。有人对如何让这一切正常工作有任何想法吗?

回答by Carlos Lima

Try this:

尝试这个:

extension_dir = "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"

without starting with the .;

不以 .;

回答by cabs

You just uncomment the extension_dir in php.ini

您只需取消注释 php.ini 中的 extension_dir

enter image description here

在此处输入图片说明

回答by icc97

Just for my future self if no-else. This is with PHP 5.2.13 running in Windows on IIS 8.

如果没有别的,只是为了我未来的自己。这是在 IIS 8 上的 Windows 中运行的 PHP 5.2.13。

I got the following error:

我收到以下错误:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_openssl.dll' - The specified module could not be found.

PHP 警告:PHP 启动:无法加载动态库 'C:\Program Files (x86)\PHP\ext\php_openssl.dll' - 找不到指定的模块。

From phpinfo()the loaded php.ini file was C:\Program Files (x86)\PHP\php.ini.

phpinfo()加载的 php.ini 文件是C:\Program Files (x86)\PHP\php.ini.

The extension directory:

扩展目录:

extension_dir ="C:\Program Files (x86)\PHP\ext"

These were the last two lines of the php.inifile:

这些是php.ini文件的最后两行:

[PHP_SQLSRV]
extension=php_sqlsrv_52_nts_vc6.dll
[PHP_OPENSSL]
extension=php_openssl.dll

The php_openssl.dlland php_sqlsrv_52_nts_vc6.dllfiles are in the extdirectory. The php_openssl.dllisn't corrupt (it's the same file size as one on another machine that's working).

php_openssl.dllphp_sqlsrv_52_nts_vc6.dll文件在ext目录中。在php_openssl.dll未损坏(这是该文件的大小为一个的工作另一台机器上一样)。

PHP will find the sqlsrv dll but not the openssl dll. No idea why. No amounts of IIS restarting did anything.

PHP 会找到 sqlsrv dll,但不会找到 openssl dll。不知道为什么。没有多少 IIS 重新启动做任何事情。

The solution until I know better was to install the openssl.dll extension using the Windows PHP installer. You can re-run the installer and select 'Change' and it allows you to add or remove libraries. I can't see any difference in the file or the php.ini file now, but now the file loads.

直到我知道更好的解决方案是使用 Windows PHP 安装程序安装 openssl.dll 扩展。您可以重新运行安装程序并选择“更改”,它允许您添加或删除库。我现在看不到文件或 php.ini 文件有任何区别,但现在文件加载了。

I suspect actually that my problem was similar to this comment about OpenSSL installation on Windows:

我怀疑实际上我的问题类似于关于在 Windows 上安装 OpenSSL 的评论

At this point, when you start Apache it will attempt to load php_openssl.dll, but if your setup is anything like mine you will see an error. I prefer to start Apache manually, and the error appears in a dialog box: "The ordinal 4114 could not be located in the dynamic link library LIBEAY32.dll". (I'm not sure whether you would get this message if you started Apache as a service). The Apache log also contains an error message saying that php_openssl.dll cannot be loaded, though that message doesn't name libeay32.dll. Welcome to DLL Hell.

Libeay32.dll enters the picture because php_openssl.dll depends on it (and also on ssleay32.dll). What I think happens is that Apache first tries to load php_openssl.dll programmatically from the path specified by the extension_dir key. But then, the loading of the so-called dependent DLLs is left to Windows' default mechanism. If Windows finds an incompatible version of a dependent DLL, you get the error.

此时,当您启动 Apache 时,它​​将尝试加载 php_openssl.dll,但如果您的设置与我的类似,您将看到一个错误。我更喜欢手动启动Apache,在对话框中出现错误:“在动态链接库LIBEAY32.dll中找不到序号4114”。(如果您将 Apache 作为服务启动,我不确定您是否会收到此消息)。Apache 日志还包含一条错误消息,指出无法加载 php_openssl.dll,但该消息并未命名为 libeay32.dll。欢迎来到 DLL 地狱。

Libeay32.dll 进入图片是因为 php_openssl.dll 依赖于它(以及 ssleay32.dll)。我认为发生的是 Apache 首先尝试从 extension_dir 键指定的路径以编程方式加载 php_openssl.dll。但是,所谓的依赖 DLL 的加载留给 Windows 的默认机制。如果 Windows 发现依赖 DLL 的版本不兼容,则会出现错误。

I noticed errors about ssleay32.dllwhen trying to run php -ifrom the command line. I just assumed that it didn't have it in the environment. IIS made no mention of any ssleay32.dllerrors in its logs.

我注意到有关ssleay32.dll尝试从命令行运行时的错误php -i。我只是假设它在环境中没有它。IISssleay32.dll在其日志中没有提及任何错误。

回答by incognito

Had same errors, but instead of copying files added php folder to system path and restated the server.

有同样的错误,但不是复制文件,而是将 php 文件夹添加到系统路径并重新启动服务器。

回答by Szilard Szollosi

Windows 8.1 have a bib problem with system PATH names what cannot editable with the general editor because this line is too long......and for PHP module extension good loading must to define PHP path in the system enviroments.

Windows 8.1 有一个围兜问题,系统路径名称无法用通用编辑器编辑,因为这一行太长......而对于 PHP 模块扩展,良好的加载必须在系统环境中定义 PHP 路径。

ONLY one thing helped for me: https://rix0rrr.github.io/WindowsPathEditor/

只有一件事对我有帮助:https: //rix0rrr.github.io/WindowsPathEditor/