简体   繁体   English

PHP 启动:运行单元测试时无法加载动态库

[英]PHP Startup: Unable to load dynamic library, when running unit tests

when I try to run my unit tests, I get this error当我尝试运行我的单元测试时,出现此错误

PHP Warning: PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp\php\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 'fileinfo' (tried: \xampp\php\ext\fileinfo (The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'gd2' (tried: \xampp\php\ext\gd2 (The specified module could not be found.), \xampp\php\ext\php_gd2.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'gettext' (tried: \xa PHP Warning: PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (指定模块无法找到。))在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp \php\ext\php_curl.dll(找不到指定的模块。))在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'fileinfo' (tried: \xampp\php\ext\fileinfo ( The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could not be found.)) 在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'gd2' (试过:\xampp\php\ext\gd2(找不到指定的模块。),\xampp\php\ext\php_gd2.dll(找不到指定的模块。))在 Unknown on line 0 PHP Warning : PHP 启动: 无法加载动态库 'gettext' (试过: \xa mpp\php\ext\gettext (The specified module could not be found.), \xampp\php\ext\php_gettext.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: \xampp\php\ext\mbstring (The specified module could not be found.), \xampp\php\ext\php_mbstring.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: \xampp\php\ext\exif (The specified module could not be found.), \xampp\php\ext\php_exif.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be found.), \xampp\php\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 'pdo_mysql' (tried: \xampp\php\ext\pdo_mysql (The specified module could not b mpp\php\ext\gettext(找不到指定的模块。),\xampp\php\ext\php_gettext.dll(找不到指定的模块。))在 Unknown on line 0 PHP Warning: PHP Startup:无法加载动态库'mbstring'(试过:\xampp\php\ext\mbstring(找不到指定的模块。),\xampp\php\ext\php_mbstring.dll(找不到指定的模块。) ) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: \xampp\php\ext\exif (The specified module could not be found.), \xampp\php\ext\php_exif .dll(找不到指定的模块。))在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be找到。), \xampp\php\ext\php_mysqli.dll (找不到指定的模块。)) 在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: \xampp\ php\ext\pdo_mysql (指定的模块不能b e found.), \xampp\php\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 'pdo_sqlite' (tried: \xampp\php\ext\pdo_sqlite (The specified module could not be found.), \xampp\php\ext\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: \xampp\php\ext\php_openssl.dll (The specified module could not be found.), \xampp\php\ext\php_php_openssl.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: \xampp\php\ext\php_ftp.dll (The specified module could not be found.), \xampp\php\ext\php_php_ftp.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown on line 0 e found.), \xampp\php\ext\php_pdo_mysql.dll (The specified module could not be found.)) 在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: \xampp \php\ext\pdo_sqlite (找不到指定的模块。), \xampp\php\ext\php_pdo_sqlite.dll (找不到指定的模块。)) in Unknown on line 0 PHP Warning: PHP Startup: Unable加载动态库'php_openssl.dll'(试过:\xampp\php\ext\php_openssl.dll(找不到指定的模块。),\xampp\php\ext\php_php_openssl.dll.dll(找不到指定的模块)未找到。))在 Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll'(试过:\xampp\php\ext\php_ftp.dll(找不到指定的模块。) , \xampp\php\ext\php_php_ftp.dll.dll(找不到指定的模块。))在 Unknown on line 0 PHP Warning: Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown在第 0 行

Warning: PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could be找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp\php\ext\php_curl.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp\php\ext\php_curl.dll (The specified module could be找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'fileinfo' (tried: \xampp\php\ext\fileinfo (The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'fileinfo' (tried: \xampp\php\ext\fileinfo (The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could be找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'gd2' (tried: \xampp\php\ext\gd2 (The specified module could not be found.), \xampp\php\ext\php_gd2.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'gd2' (tried: \xampp\php\ext\gd2 (The specified module could not be found.), \xampp\php\ext\php_gd2.dll (The specified module could be找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'gettext' (tried: \xampp\php\ext\gettext (The specified module could not be found.), \xampp\php\ext\php_gettext.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'gettext' (试过: \xampp\php\ext\gettext (找不到指定的模块。), \xampp\php\ext\php_gettext.dll (指定的模块可以找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: \xampp\php\ext\mbstring (The specified module could not be found.), \xampp\php\ext\php_mbstring.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP 启动:无法加载动态库 'mbstring'(已尝试:\xampp\php\ext\mbstring(找不到指定的模块。)、\xampp\php\ext\php_mbstring.dll(指定的模块可能无法找到)找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: \xampp\php\ext\exif (The specified module could not be found.), \xampp\php\ext\php_exif.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP 启动:无法加载动态库 'exif'(已尝试:\xampp\php\ext\exif(找不到指定的模块。)、\xampp\php\ext\php_exif.dll(指定的模块可能无法找到)找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be found.), \xampp\php\ext\php_mysqli.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be found.), \xampp\php\ext\php_mysqli.dll (The specified module could be找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: \xampp\php\ext\pdo_mysql (The specified module could not be found.), \xampp\php\ext\php_pdo_mysql.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP Startup: Unable to load dynamic library 'pdo_mysql' (试过: \xampp\php\ext\pdo_mysql (找不到指定的模块。), \xampp\php\ext\php_pdo_mysql.dll (找不到指定的模块)找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: \xampp\php\ext\pdo_sqlite (The specified module could not be found.), \xampp\php\ext\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP 启动:无法加载动态库 'pdo_sqlite'(已尝试:\xampp\php\ext\pdo_sqlite(找不到指定的模块。)、\xampp\php\ext\php_pdo_sqlite.dll(指定的模块可能无法找到)找不到。)) 在第 0 行的未知中

Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: \xampp\php\ext\php_openssl.dll (The specified module could not be found.), \xampp\php\ext\php_php_openssl.dll.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP 启动:无法加载动态库 'php_openssl.dll'(已尝试:\xampp\php\ext\php_openssl.dll(找不到指定的模块。)、\xampp\php\ext\php_php_openssl.dll。 dll(找不到指定的模块。))在第 0 行未知

Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: \xampp\php\ext\php_ftp.dll (The specified module could not be found.), \xampp\php\ext\php_php_ftp.dll.dll (The specified module could not be found.)) in Unknown on line 0警告:PHP 启动:无法加载动态库 'php_ftp.dll'(已尝试:\xampp\php\ext\php_ftp.dll(找不到指定的模块。)、\xampp\php\ext\php_php_ftp.dll。 dll(找不到指定的模块。))在第 0 行未知

Could somebody help me?有人可以帮帮我吗? Thanks.谢谢。 Running in PHPstorm, Win 10在 PHPstorm 中运行,Win 10

You may need to edit your php.ini file and restart the server.您可能需要编辑php.ini文件并重新启动服务器。 Add absolute paths in php.ini configuration.php.ini配置中添加绝对路径。 It worked for xampp server in my windows 8.1 machine.它适用于我的 Windows 8.1 机器上的 xampp 服务器。
example:例子:
extension_dir="\xampp\php\ext" to extension_dir="C:\xampp\php\ext" extension_dir="\xampp\php\ext"extension_dir="C:\xampp\php\ext"

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

Edit: Additionally for my some cases, needs to edit browscap="xampp\php\extras\browscap.ini" to browscap="C:\xampp\php\extras\browscap.ini"编辑:另外对于我的某些情况,需要将browscap="xampp\php\extras\browscap.ini"编辑为browscap="C:\xampp\php\extras\browscap.ini"

You are missing the b2z module for php.您缺少 php 的 b2z 模块。 Which is normally included in the php package for windows通常包含在 windows 的 php 包中

I would suggest reinstalling php or manually moving the package from the download to the correct folder or switching to a vagrant environment.我建议重新安装 php 或手动将包从下载文件移动到正确的文件夹或切换到 vagrant 环境。

Download:下载:

https://windows.php.net/download/ https://windows.php.net/download/

In the folder ext/bz2在文件夹 ext/bz2

Move these folder contents over to the according folder.将这些文件夹内容移到相应的文件夹中。

I had faced the same problem after updating my php version from 7.0 to the latest version which is 8.1.3 as for now , the solution I used was :-在将我的 php 版本从 7.0 更新到最新版本 8.1.3 后,我遇到了同样的问题,我使用的解决方案是:-

Just comment the extension in the php.ini found in (C:\xampp\php\php.ini) extension=gd2只需在 (C:\xampp\php\php.ini) extension=gd2中找到的 php.ini 中注释扩展名

Note: comment by prefixing semicolon at the start注意:注释前加分号

Just comment out ;extension=pdo_sqlite in php.ini if you don't need it.如果不需要,只需在 php.ini 中注释掉;extension=pdo_sqlite It was enabled by default in my configuration and the error message is gone.它在我的配置中默认启用,并且错误消息消失了。

I have fought with this for the last 12 hours on my Windows 10 box.在过去的 12 个小时里,我一直在我的 Windows 10 机器上与此作斗争。 For anyone having the same trouble I am having, you need to edit the php.ini to call out the full name of the DLL file.对于遇到同样问题的任何人,您需要编辑 php.ini 以调出 DLL 文件的全名。 I had to change pdo_sqlite to php_pdo_sqlite.dll and sqlite3 to php_sqlite3.dll.我不得不将 pdo_sqlite 更改为 php_pdo_sqlite.dll,将 sqlite3 更改为 php_sqlite3.dll。

在 php.ini 中添加 php ext dir 后,我还需要将 php dir 添加到 windows 路径(环境变量)

在您的php.ini文件中,找到 text=> extension=gd2并将其;extension=gd2

For windows 10 users, make open "XAMP" programe, then at apache click button "config" then edit "php.ini".对于 Windows 10 用户,打开“XAMP”程序,然后在 apache 上单击“配置”按钮,然后编辑“php.ini”。

#1- remove the semicolon (;) before this line #1- 删除此行之前的分号 (;)

extension=php_gd.dll

#2- restart xamp #2- 重启 xamp

#Problem: when try to "composer update" print error: #Problem:当尝试“作曲家更新”打印错误时:

 Problem 1
    - maatwebsite/excel[3.1.28, ..., 3.1.30] require phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/pfice/phpspreadsheet[1.16.0].
    - maatwebsite/excel[3.1.31, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpofficeoffice/phpspreadsheet[1.18.0, ..., 1.25.2].
    - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[sheet[1.16.0, ..., 1.25.2].
    - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[sheet[1.15.0, ..., 1.25.2].
    - maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.6) does not satisfy that reqat requirement.
    - phpoffice/phpspreadsheet[1.15.0, ..., 1.25.2] require ext-gd * -> it is missing from your system. Install orall or enable PHP's gd extension.
    - Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

enter image description here在此处输入图像描述

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

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