如何修复 PHP 警告:PHP 启动:无法加载动态库 'ext\php_curl.dll'? [英] How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_curl.dll'?

查看:48
本文介绍了如何修复 PHP 警告:PHP 启动:无法加载动态库 'ext\php_curl.dll'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在 Windows Server 2008 R2 上安装了 PHP 5.5.12 和 Apache 2.4.一切都运行完美,没有问题/警告.

I currently have PHP 5.5.12 and Apache 2.4 installed on Windows Server 2008 R2. Everything is running perfectly with no issue/warnings.

我所做的是将相同的 Apache 文件/配置复制到另一台服务器.我复制了 C:PHP 目录,然后复制了 C:Apache24 目录并将它们粘贴到新服务器中.

What I have done is copied the same Apache file/configuration to another server. I copied the C:PHP directory and then the C:Apache24 directory and pasted them into the new server.

然后我通过一个更改安装了 Apache(即 httpd -k install.)我将端口号从 80 更改为 8877.Apache 工作没有问题,它正在 8877 上运行港口.我也可以通过转到 SERVER_IP_ADDRESS:8877 打开默认页面,它可以工作.

Then I installed the Apache with one change (ie httpd -k install.) I changed the port number from 80 to 8877. The Apache is working with no issue and it is running on the 8877 port. I can also open the default page by going to SERVER_IP_ADDRESS:8877 and it works.

但是,PHP 无法正常工作.在 Apache 服务器的 error.log 文件中,我收到下面列出的警告

But, PHP is not working as it should. In the error.log file from the Apache server I get the warning listed below

PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_curl.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_ldap.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_mysql.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_mysqli.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_openssl.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_pdo_mysql.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_sqlsrv_55_ts.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_pdo_sqlsrv_55_ts.dll' - The specified module could not be found.
 in Unknown on line 0

我似乎无法弄清楚为什么会出现此错误?警告指出找不到指定的模块"的所有 .dll 文件确实存在于 C:PHPext 目录中php

I can't seem to figure out why I get this error? All the .dll files that the warning is stating "The specified module could not be found" do exists in the C:PHPext directoryphp

PHP 扩展位于

C:phpext

在文件 php.ini 中我有这个变量

Inside the file php.ini I have this variable

extension_dir = "ext"

这是 ext 文件夹的目录列表

here is a directory listing of the ext folder

 Volume in drive C is OS
 Volume Serial Number is C63C-1D75

 Directory of C:phpext

07/29/2014  06:42 PM    <DIR>          .
07/29/2014  06:42 PM    <DIR>          ..
04/30/2014  02:46 PM            66,560 php_bz2.dll
04/30/2014  02:46 PM            72,704 php_com_dotnet.dll
04/30/2014  02:46 PM           507,392 php_curl.dll
04/30/2014  02:46 PM            18,944 php_enchant.dll
04/30/2014  02:46 PM            43,008 php_exif.dll
04/30/2014  02:46 PM         2,679,808 php_fileinfo.dll
04/30/2014  02:46 PM         1,358,848 php_gd2.dll
04/30/2014  02:46 PM            40,960 php_gettext.dll
04/30/2014  02:46 PM           240,128 php_gmp.dll
04/30/2014  02:46 PM           831,488 php_imap.dll
04/30/2014  02:46 PM            65,024 php_interbase.dll
04/30/2014  02:46 PM           261,632 php_intl.dll
04/30/2014  02:46 PM           179,200 php_ldap.dll
04/30/2014  02:46 PM         1,239,552 php_mbstring.dll
04/30/2014  02:46 PM            36,864 php_mysql.dll
04/30/2014  02:46 PM            88,576 php_mysqli.dll
04/30/2014  02:46 PM           141,824 php_oci8.dll
04/30/2014  02:46 PM           142,336 php_oci8_11g.dll
04/30/2014  02:46 PM           120,320 php_opcache.dll
04/30/2014  02:46 PM            72,704 php_openssl.dll
04/30/2014  02:46 PM            21,504 php_pdo_firebird.dll
04/30/2014  02:46 PM            24,576 php_pdo_mysql.dll
04/30/2014  02:46 PM            23,040 php_pdo_oci.dll
04/30/2014  02:46 PM            20,480 php_pdo_odbc.dll
04/30/2014  02:46 PM            27,648 php_pdo_pgsql.dll
04/30/2014  02:46 PM           465,408 php_pdo_sqlite.dll
08/28/2012  04:15 PM           186,520 php_pdo_sqlsrv_54_ts.dll
06/26/2013  03:22 PM           166,400 php_pdo_sqlsrv_55_ts.dll
04/30/2014  02:46 PM            90,112 php_pgsql.dll
04/30/2014  02:46 PM            12,288 php_shmop.dll
04/30/2014  02:46 PM           385,536 php_snmp.dll
04/30/2014  02:46 PM           236,544 php_soap.dll
04/30/2014  02:46 PM            54,784 php_sockets.dll
04/30/2014  02:46 PM           617,472 php_sqlite3.dll
08/28/2012  04:15 PM           204,952 php_sqlsrv_54_ts.dll
06/26/2013  03:22 PM           183,296 php_sqlsrv_55_ts.dll
04/30/2014  02:46 PM            31,744 php_sybase_ct.dll
04/30/2014  02:46 PM           236,544 php_tidy.dll
04/30/2014  02:46 PM            51,712 php_xmlrpc.dll
04/30/2014  02:46 PM           231,936 php_xsl.dll
              40 File(s)     11,480,368 bytes
               2 Dir(s)  83,103,895,552 bytes free

当我尝试访问网站时出现此错误

When I try to access the website I get this error

致命错误:未定义的类常量 'MYSQL_ATTR_INIT_COMMAND'

Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

这是因为没有加载扩展.

which is because the extensions are not loaded.

我假设配置是正确的,因为相同的配置在不同的服务器上运行.

I am assuming that the configuration are correct since the same configuration are working on a different server.

如何解决这个 PHP 启动问题?

How can I fix this PHP Startup issue?

推荐答案

As Darren 评论, Apache 不理解 php.ini 在 Windows 中的相对路径.

As Darren commented, Apache don't understand php.ini relative paths in Windows.

要修复它,请将 php.ini 中的相对路径更改为绝对路径.

To fix it, change the relative paths in your php.ini to absolute paths.

extension_dir="C:fullpath	ophpextdir"

这篇关于如何修复 PHP 警告:PHP 启动:无法加载动态库 'ext\php_curl.dll'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆