如何修复 PHP 警告:PHP 启动:无法加载动态库 'ext\\php_curl.dll'?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25027013/
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
How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_curl.dll'?
提问by Jaylen
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.
我目前在 Windows Server 2008 R2 上安装了 PHP 5.5.12 和 Apache 2.4。一切都运行完美,没有问题/警告。
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 文件/配置复制到另一台服务器。我复制了C:\PHP
目录,然后复制了目录并将C:\Apache24
它们粘贴到新服务器中。
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.
然后我通过一个更改(即httpd -k install
。)安装了 Apache 。我将端口号从 80 更改为 8877。Apache 工作没有问题,它在 8877 端口上运行。我也可以通过转到 SERVER_IP_ADDRESS:8877 打开默认页面并且它可以工作。
But, PHP is not working as it should. In the error.log file from the Apache server I get the warning listed below
但是,PHP 无法正常工作。在 Apache 服务器的 error.log 文件中,我收到下面列出的警告
PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_curl.dll' - The specified module could not be found.\r\n 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.\r\n 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.\r\n 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.\r\n 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.\r\n 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.\r\n 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.\r\n 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.\r\n in Unknown on line 0
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:\PHP\ext directoryphp
我似乎无法弄清楚为什么会出现此错误?警告指出“找不到指定的模块”的所有 .dll 文件都存在于 C:\PHP\ext 目录中
The PHP extensions are located in
PHP 扩展位于
C:\php\ext
Inside the file php.ini I have this variable
在文件 php.ini 我有这个变量
extension_dir = "ext"
here is a directory listing of the ext folder
这是 ext 文件夹的目录列表
Volume in drive C is OS
Volume Serial Number is C63C-1D75
Directory of C:\php\ext
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
当我尝试访问该网站时出现此错误
Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'
致命错误:未定义的类常量 '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.
我假设配置是正确的,因为相同的配置在不同的服务器上工作。
How can I fix this PHP Startup issue?
如何解决此 PHP 启动问题?
回答by gmsantos
As Darrencommented, Apache don't understand php.ini
relative paths in Windows.
正如Darren评论的那样,Apache 不理解php.ini
Windows 中的相对路径。
In PHP manual we have an How-to install Apache 2.x on Microsoft Windows. One of the commentssuggests using absolute paths.
在 PHP 手册中,我们有一个 How-to install Apache 2.x on Microsoft Windows。其中一条评论建议使用绝对路径。
So, try changing the relative paths in your php.ini
to absolute paths.
因此,尝试将您的相对路径更改php.ini
为绝对路径。
extension_dir="C:\full\path\to\php\ext"
回答by surajprogrammez
Use absolute path:
使用绝对路径:
extension_dir="C:\full\path\here"
回答by Zorro Sistemas
No prompt use:
无提示使用:
dir /x
Procure o nome reduzidodo diretório na linha do "Program Files (x86)"
获得 o nome reduzidodo diretório na linha do "Program Files (x86)"
27/08/2018 15:07 <DIR> PROGRA~2 Program Files (x86)
Coloque a seguinte configura??o em php.inipara a op??o:
Coloque a seguinte configura??o em php.inipara a op??o:
extension_dir="C:\PROGRA~2\path\to\php\ext"
Acredito que isso resolverá seu problema.
Acredito que isso resolverá seu problema。
Zorro
佐罗
回答by ztvmark
Espa?ol
西班牙文
Si estas usando laragon abre el php.ini
Si estas usando laragon abre el php.ini
En la interfaz de laragon menu->php->php.ini
En la interfaz de laragon menu->php->php.ini
cuando abra el archivo busca ;extension_dir = "./"
cuando abra el archivo busca ;extension_dir = "./"
crea otro sin ;con el path de tu version de php a la carpeta extpor ejemplo
创造奥托辛;con el path de tu version de php a la carta extpor ejemplo
extension_dir = "C:\laragon\bin\php\php-7.3.11-Win32-VC15-x64\ext"
al cambiarlo guárdalo
阿尔坎比亚洛瓜尔达洛
English
英语
If you are using laragon open the php.ini
如果你使用 laragon 打开 php.ini
In the interface of laragon menu-> php-> php.ini
在 laragon 界面中菜单-> php-> php.ini
when you open the file look for ; extension_dir = "./"
当您打开文件时查找;extension_dir = "./"
create another one without **; ** with the path of your php version to the folder ** ext ** for example
创建另一个没有**; ** 使用您的 php 版本到文件夹 ** ext ** 的路径,例如
extension_dir = "C: \ laragon \ bin \ php \ php-7.3.11-Win32-VC15-x64 \ ext"
change it save it
改变它保存它
回答by Nitsh
- Check if compatible Mysql for your PHP version is corrected installed. (eg. mysql-installer-community-5.5.40.1.msi for PHP 5.2.10, apache 2.2 and phpmyadmin 3.5.2)
- In your
php\php.ini
set your loadable php extensions path (eg.extension_dir = "C:\php\ext"
) (https://drive.google.com/open?id=1DDZd06SLHSmoFrdmWkmZuXt4DMOPIi_A) - (In your
php\php.ini
) check ifextension=php_mysqli.dll
is uncommented(https://drive.google.com/open?id=17DUt1oECwOdol8K5GaW3tdPWlVRSYfQ9) - Set your php folder(eg.
"C:\php"
) and php\extfolder (eg."C:\php\ext"
) as your runtime environment variable path(https://drive.google.com/open?id=1zCRRjh1Jem_LymGsgMmYxFc8Z9dUamKK) - Restart apache service (https://drive.google.com/open?id=1kJF5kxPSrj3LdKWJcJTos9ecKFx0ORAW)
- 检查是否安装了与您的 PHP 版本兼容的 Mysql。(例如,mysql-installer-community-5.5.40.1.msi 用于 PHP 5.2.10、apache 2.2 和 phpmyadmin 3.5.2)
- 在您的
php\php.ini
设置中,您的可加载 php 扩展路径(例如extension_dir = "C:\php\ext"
)(https://drive.google.com/open?id=1DDZd06SLHSmoFrdmWkmZuXt4DMOPIi_A) - (在您的
php\php.ini
)检查是否extension=php_mysqli.dll
未注释(https://drive.google.com/open?id=17DUt1oECwOdol8K5GaW3tdPWlVRSYfQ9) - 将您的php 文件夹(例如
"C:\php"
)和php\ext文件夹(例如"C:\php\ext"
)设置为您的运行时环境变量路径(https://drive.google.com/open?id=1zCRRjh1Jem_LymGsgMmYxFc8Z9dUamKK) - 重启 apache 服务(https://drive.google.com/open?id=1kJF5kxPSrj3LdKWJcJTos9ecKFx0ORAW)
回答by alek litvinov
maybe useful for somebody, I got next problem on windows 8, apache 2.4, php 7+.
也许对某人有用,我在 windows 8、apache 2.4、php 7+ 上遇到了下一个问题。
php.ini conf>
extension_dir="C:/Server/PHP7/ext"
php on apache works ok but on cli problem with libs loading, as a result, I changed to
apache 上的 php 工作正常,但在 libs 加载时出现 cli 问题,因此,我改为
extension_dir="C:/server/PHP7/ext"
回答by Georg
I have the same issue with windows10, apache 2.2.25, php 5.2 Im trying to add GD to a working PHP.
我在 windows10、apache 2.2.25、php 5.2 上也有同样的问题 我正在尝试将 GD 添加到正在运行的 PHP 中。
how I turn around and change between forward and backward slash, plus trailing or not, I get some variant of ;
我如何转身并在正斜杠和反斜杠之间切换,加上尾随与否,我得到了一些变体;
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php\php_gd2.dll' - Det g\xe5r inte att hitta den angivna modulen.\r\n in Unknown on line 0
PHP 警告:PHP 启动:无法加载动态库 'C:/php\php_gd2.dll' - Det g\xe5r inte att hitta den angivna modulen.\r\n in Unknown on line 0
(swedish translated: 'It is not possible to find the module' )
(瑞典语翻译:'不可能找到模块')
in this perticular case, the php.ini was: extension_dir = "C:/php"
在这种特殊情况下,php.ini 是: extension_dir = "C:/php"
the dll is put in two places C:\php and C:\php\ext
dll 放在两个地方 C:\php 和 C:\php\ext
IS it possible that there is and "error" in the error log entry ? I.e. that the .dll IS found (as a file) but not of the right format, or something like that ??
错误日志条目中是否可能存在“错误”?即找到了 .dll(作为文件)但格式不正确,或者类似的东西??