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

时间:2011-07-26 09:21:13

标签: php macos phpunit

我的mac上有phpunit的问题。

当我运行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

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

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

提前致谢。

3 个答案:

答案 0 :(得分:4)

我在josegonzalez'homebrew安装的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

原来问题是由于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?

删除该行会使警告消失。

答案 1 :(得分:2)

forum thread所述,目录必须位于LD_LIBRARY_PATH

首次运行

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

现在你不应该再犯错误了。

答案 2 :(得分:1)

对我来说问题是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