简体   繁体   English

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

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

This is becoming a very frustrating issue. 这成为一个非常令人沮丧的问题。 I am trying to do a clean install of apache 2.2 and PHP 5.2.11. 我正在尝试干净安装apache 2.2和PHP 5.2.11。 Everything seems to be configured correctly but the php modules aren't starting... 一切似乎都配置正确,但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... 所有文件都在那里... .sll文件,如ssleay32.dll,libmcrypt.dll,libmysql.dll,libeay32.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? 任何人都有任何关于如何使这一切工作正常的想法?

Try this: 尝试这个:

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

without starting with the .; 没有开始.;

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.ini file: 这些是php.ini文件的最后两行:

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

The php_openssl.dll and php_sqlsrv_52_nts_vc6.dll files are in the ext directory. php_openssl.dllphp_sqlsrv_52_nts_vc6.dll文件位于ext目录中。 The php_openssl.dll isn't corrupt (it's the same file size as one on another machine that's working). php_openssl.dll没有损坏(它的文件大小与另一台正常工作的文件大小相同)。

PHP will find the sqlsrv dll but not the openssl dll. PHP将找到sqlsrv dll但不会找到openssl dll。 No idea why. 不知道为什么。 No amounts of IIS restarting did anything. 没有任何IIS重新启动做任何事情。

The solution until I know better was to install the openssl.dll extension using the Windows PHP installer. 直到我知道更好的解决方案是使用Windows PHP安装程序安装openssl.dll扩展。 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. 我现在看不到文件或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. 此时,当您启动Apache时,它将尝试加载php_openssl.dll,但如果您的设置与我的类似,则会看到错误。 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". 我更喜欢手动启动Apache,并且错误出现在对话框中:“序号4114无法位于动态链接库LIBEAY32.dll中”。 (I'm not sure whether you would get this message if you started Apache as a service). (如果您将Apache作为服务启动,我不确定您是否会收到此消息)。 The Apache log also contains an error message saying that php_openssl.dll cannot be loaded, though that message doesn't name libeay32.dll. Apache日志还包含一条错误消息,指出无法加载php_openssl.dll,但该消息未命名libeay32.dll。 Welcome to DLL Hell. 欢迎来到DLL地狱。

Libeay32.dll enters the picture because php_openssl.dll depends on it (and also on ssleay32.dll). Libeay32.dll进入图片,因为php_openssl.dll依赖于它(以及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. 我认为发生的是Apache首先尝试以编程方式从extension_dir键指定的路径加载php_openssl.dll。 But then, the loading of the so-called dependent DLLs is left to Windows' default mechanism. 但是,所谓的依赖DLL的加载留给了Windows的默认机制。 If Windows finds an incompatible version of a dependent DLL, you get the error. 如果Windows发现依赖DLL的不兼容版本,则会出现错误。

I noticed errors about ssleay32.dll when trying to run php -i from the command line. 我尝试从命令行运行php -i时发现有关ssleay32.dll错误。 I just assumed that it didn't have it in the environment. 我只是假设它在环境中没有它。 IIS made no mention of any ssleay32.dll errors in its logs. IIS没有在其日志中提及任何ssleay32.dll错误。

You just uncomment the extension_dir in php.ini 您只需取消注释php.ini中的extension_dir即可

在此输入图像描述

有相同的错误,但不是复制文件添加php文件夹到系统路径,并重申服务器。

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有一个系统PATH名称的bib问题无法使用通用编辑器编辑,因为这行太长了......对于PHP模块扩展,良好的加载必须在系统环境中定义PHP路径。

ONLY one thing helped for me: https://rix0rrr.github.io/WindowsPathEditor/ 只有一件事对我有帮助: https//rix0rrr.github.io/WindowsPathEditor/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM