简体   繁体   English

在 Windows 中运行 PHP:如何解决“PHP 启动:无法加载动态库”问题?

[英]Running PHP in Windows: how to fix "PHP Startup: Unable to load dynamic library" issues?

I have determined path to php folder and trying to run some php file and getting this message from command line.我已经确定了 php 文件夹的路径并尝试运行一些 php 文件并从命令行获取此消息。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\U1>php
Failed loading \usr\local\php5\ext\php_xdebug-2.2.0-5.3-vc9.dll
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_curl.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\
php_curl.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_gd2
.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_gd
2.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_mbstring.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_mb
string.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_mysql.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_my
sql.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_mys
qli.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_my
sqli.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_pdo
_mysql.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_pd
o_mysql.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_pdo
_sqlite.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_pd
o_sqlite.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_sql
ite.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_sq
lite.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_soa
p.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_so
ap.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_sql
ite3.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_sq
lite3.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>PHP Wa
rning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\php_xsl
.dll' - The specified module could not be found.
 in Unknown on line 0
<!--error-->
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/ext\
php_xsl.dll' - The specified module could not be found.
 in Unknown on line 0
<script language=JavaScript src='/denwer/errors/phperror_js.php'></script>
^A

All libraries are open on php.ini file.所有库都在 php.ini 文件上打开。 I have checked them all.我已经检查了所有这些。 I am wondering why command line tries to run library in incorrect path like我想知道为什么命令行会尝试以不正确的路径运行库,例如

'/usr/local/php5/ext\php_xsl.dll'

Does it should be like它应该像

'/usr/local/php5/ext/php_xsl.dll'

?

Open your php.ini file and set the following setting to a Windows file path: 打开php.ini文件并将以下设置设置为Windows文件路径:

extension_dir = "X:/path/to/your/php/ext"

On Windows, paths that point to something on a normal hard drive have to start with a letter and then a colon, like " C: ".在 Windows 上,指向普通硬盘驱动器上某物的路径必须以字母开头,然后是冒号,例如“ C: ”​​。 Paths that start with a forward slash, / , are Unix-like paths, and will not work on Windows.以正斜杠/开头的路径是类 Unix 路径,在 Windows 上不起作用。

Adjust the following value in php.ini:在 php.ini 中调整以下值:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\path to extension directory"

You can also specify the extensions directory without using the full path if it's in the same folder, at least in PHP 7.2.5 (have not tested other versions).如果扩展目录位于同一文件夹中,您也可以指定扩展目录而不使用完整路径,至少在 PHP 7.2.5 中(尚未测试其他版本)。

Example:例子:

extension_dir = "ext"

Where ext is your extensions directory.其中ext是您的扩展目录。

Check the dll / library path from the error and make sure it's correct.检查错误中的 dll / 库路径并确保它是正确的。 Updating /php.ini-> extension_dir to the correct path solves my problem.将 /php.ini-> extension_dir 更新到正确的路径可以解决我的问题。

I have 7.4 php version.我有 7.4 php 版本。 I solved this by uncommenting the following line by removing;我通过删除取消注释以下行来解决这个问题; inside the php.ini file.在 php.ini 文件中。

extension_dir = "ext"

Note that initially, if you won't have php.ini file you should first copy and paste php.ini-development file and rename it as php.ini.请注意,最初,如果您没有 php.ini 文件,您应该首先复制并粘贴 php.ini-development 文件并将其重命名为 php.ini。

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

相关问题 如何修复 PHP 启动:无法加载动态库? - How to fix PHP Startup: Unable to load dynamic library? PHP启动:无法在Windows上加载动态库 - PHP Startup: Unable to load dynamic library on Windows 如何修复 PHP 警告:PHP 启动:无法加载动态库 &#39;ext\\\\php_curl.dll&#39;? - How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_curl.dll'? 如何解决PHP警告:PHP启动:无法加载动态库&#39;php_ffmpeg.dll&#39; - How to fix PHP warning: PHP Startup: Unable to load dynamic library 'php_ffmpeg.dll' 如何修复:PHP 启动:无法加载动态库 'php_pdo_sqlsrv_80_nts_x64'? - How to fix: PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_80_nts_x64'? 如何修复“PHP 警告:PHP 启动:无法加载动态库‘mongodb’” - How do I fix "PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' " 如何修复 PHP 警告:PHP 启动:无法加载动态库“xxx/xxx/yaf.so”? - How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'xxx/xxx/yaf.so'? PHP 启动:运行单元测试时无法加载动态库 - PHP Startup: Unable to load dynamic library, when running unit tests PHP 启动:无法加载动态库“http”-Windows 10 - PHP Startup: Unable to load dynamic library 'http' - Windows 10 PHP启动:无法加载动态库 - php startup :unable to load dynamic library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM