macos PHPUnit 动态库警告 - 找不到图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6827880/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:14:15  来源:igfitidea点击:

PHPUnit dynamic library warnings - image not found

phpmacosphpunit

提问by Dave Harding

I'm having some problems with phpunit on my mac.

我的 mac 上的 phpunit 有一些问题。

When I run phpunit, I get the following errors

当我运行 phpunit 时,出现以下错误

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo.so' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo.so' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so, 9): image not found in Unknown on line 0

Any ideas why? I've manually added mcrypt to my system using this guide - http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/

任何想法为什么?我已经使用本指南手动将 mcrypt 添加到我的系统 - http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6 -1/

I'm confused as to why its looking for an image.

我很困惑为什么它要寻找图像。

Thanks in advance.

提前致谢。

采纳答案by cweiske

As described in a forum thread, the directory needs to be in your LD_LIBRARY_PATH.

论坛主题所述,该目录需要在您的LD_LIBRARY_PATH.

First run

首轮

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/php/extensions/no-debug-non-zts-20090626/
$ php --version

You should get no more errors now.

你现在应该不会再有错误了。

回答by kojiro

I had this issue with xhprof and php installed with josegonzalez' homebrew:

我在使用 josegonzalez 的自制软件安装了 xhprof 和 php 时遇到了这个问题:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php53/5.3.23/lib/php/extensions/no-debug-non-zts-20090626/xhprof.so' - dlopen(/usr/local/Cellar/php53/5.3.23/lib/php/extensions/no-debug-non-zts-20090626/xhprof.so, 9): image not found in Unknown on line 0

Turns out the problem was due to an extra line in the php.ini, probably a vestige from a previous install.

原来问题是由于 php.ini 中的一个额外行,可能是以前安装的痕迹。

$ grep -RF xhprof .
./conf.d/ext-xhprof.ini:[xhprof]
./conf.d/ext-xhprof.ini:extension="/usr/local/Cellar/php53-xhprof/0.9.2/xhprof.so"
./php.ini:extension="xhprof.so" ; <-- this, why do I need to load xhprof twice?

Removing that line made the warning go away.

删除该行使警告消失。

回答by Jurriaan Roelofs

For me the problem was that php was updated from 5.3.26 to 5.3.27 but the modules were only in the /usr/local/Cellar/php53/5.3.26/lib/php/extensions directory while php searched them in the /usr/local/Cellar/php53/5.3.27/lib/php/extensions directory. I just had to copy the extensions folder over from the old 5.3.26 location:

对我来说,问题是 php 从 5.3.26 更新到 5.3.27 但模块只在 /usr/local/Cellar/php53/5.3.26/lib/php/extensions 目录中,而 php 在 / usr/local/Cellar/php53/5.3.27/lib/php/extensions 目录。我只需要从旧的 5.3.26 位置复制扩展文件夹:

rsync -arv /usr/local/Cellar/php53/5.3.26/lib/php/extensions /usr/local/Cellar/php53/5.3.27/lib/php

rsync -arv /usr/local/Cellar/php53/5.3.26/lib/php/extensions /usr/local/Cellar/php53/5.3.27/lib/php