Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit dynamic library warnings - image not found

Tags:

php

macos

phpunit

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

When I run phpunit, I get the following errors

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/

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

Thanks in advance.

like image 781
Dave Harding Avatar asked Jul 26 '11 09:07

Dave Harding


2 Answers

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

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.

$ 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.

like image 137
kojiro Avatar answered Oct 23 '22 03:10

kojiro


As described in a forum thread, the directory needs to be in your 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.

like image 2
cweiske Avatar answered Oct 23 '22 03:10

cweiske