PHP 警告:PHP 启动:无法加载动态库

发布于 2024-10-21 10:24:50 字数 275 浏览 4 评论 0 原文

我运行 PHP 脚本并收到此错误:

PHP 警告:PHP 启动:无法加载动态库 '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/ php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: 无法打开共享对象文件: 第 0 行的未知中没有这样的文件或目录

这是什么意思?

I run a PHP script and get this error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0

What does that mean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(20

⒈起吃苦の倖褔 2024-10-28 10:24:50

这意味着您的 php 配置文件之一中有一个 extension=...zend_extension=... 行(php.ini,或另一个接近它)正在尝试加载该扩展:ixed.5.2.lin

不幸的是,该文件或路径不存在或权限不正确。

  1. 尝试在 PHP 加载的 .ini 文件中进行搜索(phpinfo() 可以指示是哪些文件) - 其中一个应该尝试加载该扩展。
  2. 更正文件的路径或注释掉相应的行。

It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin

Unfortunately that file or path doesn't exist or the permissions are incorrect.

  1. Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
  2. Either correct the path to the file or comment out the corresponding line.
糖粟与秋泊 2024-10-28 10:24:50

如果您使用的是 Linux,则可以通过在 shell 中键入以下内容来找到所有加载的配置文件:

php -r "print phpinfo();" | grep ".ini"

更新:
正如评论中提到的,这可能更准确:

php -i | grep ini

If you're on Linux, you can find all loaded configuration files by typing this in shell:

php -r "print phpinfo();" | grep ".ini"

UPDATE:
As mentioned in comments, this can be even more accurate:

php -i | grep ini
知你几分 2024-10-28 10:24:50

phpStom 与 XAMPP

TL;DR 除了验证文件是否存在之外,您可能需要将驱动器号添加到 php.ini 文件中的某些记录

我突然开始有一个使用 phpStorm 7 通过 xampp 和 xdebug 调试 php 时出现问题。当尝试将 intellij interperter 设置为 xampps php 时,我收到了很多警告,例如问题中的警告,例如:

无法加载动态库“/xampp/php/ext/php_bz2.dll”

器号添加到 php.ini 文件中的 extension_dir 和 browscap 的记录中:

extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"

由于某种原因,我必须将驱动

extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"

phpStom with XAMPP

TL;DR Except from verifying that the files exist, you might need to add the drive letter to some records in your php.ini file

I suddenly started having a problem using phpStorm 7 for debugging php with xampp and xdebug. When trying to set intellij interperter to be xampps php I got a lot of the warnings like the one in the question, for example:

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

For some reason I had to add my drive letter to the records of extension_dir and browscap in the php.ini file:

extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"

to

extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"
预谋 2024-10-28 10:24:50

如果您只是想让错误消失,并且不需要扩展,那么请务必在 php.ini 中注释掉该行。但如果您确实想解决问题,这里有一些附加信息。

根据具体模块,造成这种情况的原因有多种,但也有一些通用准则。

  1. 打开 phpinfo() 并在 Core 部分下查找 extension_dir。这是您的模块应该位于的位置。

例如,对于 Unix/Linux,/usr/lib/php/modules

  1. 如果该文件确实存在,请确保权限足够。
  2. 如果该文件不存在,请使用以下资源进行安装。

在 *nix (PEAR) 上安装
在 Windows 上安装扩展

If you just want to make the error disappear, and you don't need the extension, then by all means comment the line out in php.ini. But if you actually want to fix the problem here is some additional info.

There are various causes for this based on the exact module, but there are also some general guidelines.

  1. Open phpinfo() and look for extension_dir under the Core section. This is where your modules should be located.

For instance, /usr/lib/php/modules for Unix/Linux.

  1. If the file does in fact exist, make sure permissions are adequate.
  2. If the file does not exist, use the resources below to install it.

Installation on *nix (PEAR)
Installation of extensions on Windows

半衾梦 2024-10-28 10:24:50

在 Linux 中加载 .dll

我在尝试通过 php.ini 安装 php-extension 时遇到了此警告消息> 文件;

直到我发现你无法在Linux中加载.dll扩展,

但你必须注释你想要导入的扩展 ;extension= ... .dll 并通过sudo apt-get install php-...正确安装

注意... 是您要启用的扩展名。

Loading .dll in Linux

I've encountered this warning message while I was trying to install a php-extension via the php.ini file;

until I figured out that you cannot load .dll extensions in Linux,

but you have to comment the extensions that you want to import ;extension= ... .dll and install it correctly via sudo apt-get install php-...

note: ... is the extension name you want to enable.

魔法唧唧 2024-10-28 10:24:50

php -r "echo php_ini_loaded_file();"

将在 CLI 中显示当前 ini 加载的文件,在那里搜索您的扩展名,其路径不正确。

php -r "echo php_ini_loaded_file();"

Will show in CLI current ini loaded file, search there for Your extension, path to it is incorrect.

浮生未歇 2024-10-28 10:24:50

就我而言,当我将 php 版本更新到 7.4 时,此消息开始出现。

为了解决这个问题,我必须查找 php 版本文件夹(/etc/php/7.4/apache2/ && /etc/php/7.4/cli/)中找到的 php.ini 文件,检查扩展名所在的行可以看到扩展 gd2 和 intl 未被注释。

In my case, this message started to appear when I updated the php version to 7.4.

To solve it I had to look for the php.ini files found inside the php version folder (/etc/php/7.4/apache2/ && /etc/php/7.4/cli/) checking the lines where the extensions I could see that the extensions gd2 and intl were uncommented.

零崎曲识 2024-10-28 10:24:50

当我在服务器上并行运行不同版本的 PHP 时,许多模块都出现此错误。为了解决这个问题,我需要安装它无法找到的特定 PHP 版本的软件包。因此,例如,如果我看到:-

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'

我会专门安装 PHP 版本的库:-

sudo apt-get install php7.1-xml

然后重新启动 Apache。为我修好了。您可以这样检查您的版本:-

php -v

I had this error on a number of modules when I had been running different versions of PHP side by side on my server. To sort this out, I needed to install the packages it couldn't find for that specific PHP version. So, for example, if I saw:-

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'

I would install the library for the PHP version specifically:-

sudo apt-get install php7.1-xml

And then restart Apache. Fixed it for me. You can check your version like this:-

php -v
清旖 2024-10-28 10:24:50

请注意,如果您的 PHP 库没有“其他”目录打开权限,您也可能会收到此错误。在我的特定情况下,我在使用 php -l 在文本编辑器中对脚本进行语法检查时注意到了这一点。这意味着,由于我的帐户名为“volomike”,因此该帐户无权运行 php 命令所依赖的库。

例如,在 Ubuntu 14.04 上,我将 PHP5 自动安装到路径 /usr/lib/php5/20121212+lfs 中。但是,因为我在 C++ 中构建一些共享对象,所以我搞乱了目录权限并将事情搞砸了,以致非 root 帐户没有目录执行(目录打开)权限来查看 /usr/ lib/php5/20121212+lfs.因此,我输入以下命令来纠正该问题:

sudo chmod o+x /usr/lib/php5/20121212+lfs

现在,当我以非 root 用户身份执行 php -l example.php 时,它再也不会出现“无法加载动态库”问题了。

Note that you can also get this error if your PHP library doesn't have the "other" directory opening permission. In my particular case, I noticed this when using php -l to syntax check a script in my text editor. This meant that since my account was called "volomike", that account didn't have permission to run the libraries that the php command relied upon.

For instance, on Ubuntu 14.04, I had PHP5 installed automatically into the path /usr/lib/php5/20121212+lfs. However, because I was working in C++ in building some shared objects, I messed around with the directory permissions and screwed things up such that non-root accounts did not have the directory execute (directory open) permissions to view /usr/lib/php5/20121212+lfs. So, I typed the following command to rectify that problem:

sudo chmod o+x /usr/lib/php5/20121212+lfs.

Now when I do php -l example.php as a non-root user, it never gives me this "Unabled to load dynamic library" problem anymore.

柒七 2024-10-28 10:24:50

当我尝试安装 Composer 时,我在 Windows 版 XAMPP 上遇到了同样的问题。
我做了 php -v 和 php 抛出错误:

无法加载动态库“/xampp/php/ext/php_bz2.dll”

我花了一段时间才意识到我需要设置我的 XAMPP。所以我运行 setup_xampp.bat 并且 php 恢复正常工作。

I had the same problem on XAMPP for Windows when I try to install composer.
I did php -v and php throwing error :

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

It took me a while until I realized that I need to setup my XAMPP. So I run setup_xampp.bat and php return to works like a charm.

扶醉桌前 2024-10-28 10:24:50

当我尝试安装 Composer 时,我在 Windows10 的 XAMPP 上遇到了同样的问题。

无法加载动态库“/xampp/php/ext/php_bz2.dll”

然后按照以下步骤操作,

  1. 只需在文本编辑器(如记事本++)中打开您的 current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini
  2. 现在只需找到 - 是 current_xampp_containing_drive :\xampp 存在吗?
  3. 如果没有,则找到“extension_dir”并获取驱动器名称(c、d 或您想要的驱动器)。

extension_dir="F:\xampp731\php\ext"(此处find_drive_name_from_the_file为F)

  1. 再次将 find_drive_name_from_the_file:\xampp 替换为 current_xampp_having_drive:\xampp 并保存。
  2. 现在再次启动composer安装进度,我想你的问题将会得到解决。

I had the same problem on XAMPP for Windows10 when I try to install composer.

Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'

Then follow this steps

  1. just open your current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini in texteditor (like notepad++)
  2. now just find - is the current_xampp_containing_drive:\xampp exist?
  3. if not then find the "extension_dir" and get the drive name(c,d or your desired drive) like.

extension_dir="F:\xampp731\php\ext" (here finded_drive_name_from_the_file is F)

  1. again replace with finded_drive_name_from_the_file:\xampp with current_xampp_containing_drive:\xampp and save.
  2. now again start the composer installation progress, i think your problem will be solved.
月竹挽风 2024-10-28 10:24:50

我所做的是;

1 - 我首先通过 phpinfo() 函数了解我使用的 PHP 版本

<?php   
    phpinfo();
?>

2 - 从那里您将找到配置(php.ini)文件的位置

method phpinfo() result

3 - 打开文件

4 - 注释掉类似于下图的行

这可能是一个不同的值,但它应该与扩展有关。
我不是专家,但这个过程帮助我解决了类似的问题。

输入图片此处描述

What I did was;

1 - I first find out what version of PHP I am using thru the function phpinfo()

<?php   
    phpinfo();
?>

2 - From there you will find the location of your configuration(php.ini) file

method phpinfo() result

3 - Open that file

4 - Comment out the line similar to the image below

This might be a different value but it should be related to extension.
I am no expert but this process helped me solved similar problem.

enter image description here

爱殇璃 2024-10-28 10:24:50

就我而言,我收到此错误是因为我下载了 dll 的线程安全版本(固定为 -ts-),但我安装的 php 是非线程安全版本(固定为 >-nts-)。下载正确版本的 dll(与我的 php 安装版本完全匹配)解决了该问题。

In my case I got this error because I downloaded a thread-safe version of the dll (infixed with -ts-), but my installation of php was a non-thread-safe (infixed with -nts-). Downloading the right version of the dll, exactly matching my php installation version fixed the issue.

感情旳空白 2024-10-28 10:24:50

在安装了 Windows 10 XAMPP 之后,我现在在 Ubuntu 上安装了 LAMPP (XAMPP)。与 MAC (iOS) 相比,Windows XAMPP 的配置要少得多,但现在使用 Linux Ubuntu,我的配置要多一些,因为 Linux 中的配置更多(这是一件好事)。

我困惑并激活了 mysqli.dll (和 mysql.dll:删除 /etc/php/7.2/cli/php.ini 中的“#”

我开始得到 < code>PHP警告:PHP启动:无法加载与dll相关的动态库消息我在同一文件中注释掉了mysql(and i).dll。但直到我在 /opt/lampp/etc/php.ini 中注释掉“”,该消息才消失。

看起来 XAMPP 读取了 php.ini 文件 。 /etc/php/7.2/cli 并在 /opt/lampp/etcphp.ini 中进行修改 (;extension=php_pdo_mysql. dll 在“;”重新启动 Apache 后不再有任何消息。

After Windows 10 XAMPP now I installed LAMPP (XAMPP) on Ubuntu. Windows XAMPP had a lot less to configure compare to MAC (iOS) but now with Linux Ubuntu I had a few more since there are more going in Linux (a good thing).

I confused and activated mysqli.dll (and mysql.dll: erase "#" in /etc/php/7.2/cli/php.ini

I started to get the PHP Warning: PHP Startup: Unable to load dynamic library message related to dll. I commented out mysql(and i).dll in the same file but the message didn't go away up until I commented out " " in /opt/lampp/etc/php.ini.

Looks like XAMPP reads php.ini file from /etc/php/7.2/cli and makes modification in php.ini of /opt/lampp/etc. (;extension=php_pdo_mysql.dll after ";" restarted Apache and no more any message.

青春有你 2024-10-28 10:24:50

取消注释 php.ini 中的 extension_dir = "ext" 对我有用。我正在使用 Windows

Uncomment extension_dir = "ext" in php.ini worked for me. I am using Windows

指尖上的星空 2024-10-28 10:24:50

'C:/PHP/5.2.13/ext\php_mcrypt1.dll'

我想说你的 php.ini 上有一些拼写错误(额外的 1)。也许您正在加载与您期望的不同的 php.ini(请参阅 php.ini 的输出以确保)。

除此之外,请确保 php_mcrypt.dll 和 PHP:

链接到相同的 VC 运行时库(通常为 VC6 的 msvcrt.dll 或 VC9 的 msvcrt90.dll) - 为此使用例如依赖项遍历器
都是调试版本还是发布版本
两者都启用了 ZTS 或禁用了 ZTS
对于依赖于其他库 (DLL) 的库,请确保它们可用(例如与扩展位于同一目录中)
如果上述前三个条件中的任何一个不满足,PHP 应该给你错误提示,但我还是写了这些,因为我不确定 PHP 5.2。

'C:/PHP/5.2.13/ext\php_mcrypt1.dll'

I'd say there's some typo on your php.ini (the extra 1). Perhaps you're loading a different php.ini from what you expect (see the output of php.ini to make sure).

Other than that make sure that php_mcrypt.dll and PHP:

Were linked to the same VC runtime library (typically msvcrt.dll for VC6 or msvcrt90.dll for VC9) – use e.g. the dependency walker for this
Are both debug builds or both release builds
Both have ZTS enabled or ZTS disabled
For libraries that depend on further libraries (DLLs), make sure they are available (e.g. in the same directory as the extension)
PHP should give you meaning errors if any of the first three conditions above is not satisfied, but I wrote those anyway because I'm not sure for PHP 5.2.

眼眸里的那抹悲凉 2024-10-28 10:24:50

从 C:\xampp\php\php.exe 我得到

  • 无法加载动态库''
  • C:\xampp\php\ext\php_.dll (找不到指定的模块。)

我解决了通过注释掉
C:\xampp\php\php.ini
;扩展名=

From C:\xampp\php\php.exe I got

  • Unable to load dynamic library ''
  • C:\xampp\php\ext\php_.dll (The specified module could not be found.)

I solved by commenting out
C:\xampp\php\php.ini
;extension=

乄_柒ぐ汐 2024-10-28 10:24:50

当我尝试将 php 与 sql server 一起使用时,当我添加 sqlsrv 库时,我遇到了同样的问题...它给了我错误,经过几天的研究,我了解到微软在这种情况下不支持 x64 那么什么我所做的是安装 laragon x86 并使用相应的库。我希望它能有所帮助

I had the same problem when I tried to use php with sql server, when I added the sqlsrv libraries ... it gave me the error, after several days of researching there, I understood that microsoft does not support x64 in this case so what I did was install laragon x86 and use the corresponding libraries. I hope it helps with something

自在安然 2024-10-28 10:24:50

转到系统环境变量并设置 php ext dir 路径,因为

C:\xampp\php\ext

基本上它是找到 ext 目录,然后找到它的文件,但无法找到文件,因为 php 路径设置为不同。

Go to system env variable and set the php ext dir path as

C:\xampp\php\ext

basically it's finding the ext directory and then locating it's file but it's unable to find the files becuase php path is set as different.

感受沵的脚步 2024-10-28 10:24:50

看看架构(arm64,amd64,...)!

我在 macOS 上的 lando (docker DEBIAN 11) 中使用 pdflib for php 遇到了这个问题。

问题是我的 php_pdflib.so 副本是为 linux/amd64 打包的,但在 docker 中我运行的是 Debain arm64 版本。

因此,解决方案是为正确的架构使用正确的包:)

在 Debian(基于)linux 上,您可以通过以下方式找到您的架构师

dpkg --print-architecture

您还可以通过以下方式分析您的共享对象(.so 文件):

ldd

Look at the architecture (arm64, amd64, ...) !

I ran into this problem with pdflib for php in lando (docker DEBIAN 11) on macOS.

The problem was that my copy of php_pdflib.so was packaged for linux/amd64 but in docker I was running Debain arm64 version.

So thew solution is to use the right package for the right architecture :)

On Debian(-based) linux you can find out your architect with

dpkg --print-architecture

Also you can analyze your shared object (.so-file) with:

ldd
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文