I've just performed a fresh install of php 5.5(.19) on Mac OSX 10.10.1 through Brew and symlinked libphp5.so
from the Brew install to /usr/libexec/apache2/libphp5.so
.
Firing up a script through Apache with phpinfo()
tells me that the loaded php.ini
file is located at /usr/local/etc/php/5.5/php.ini
.
I've added this to the bottom of the php.ini
:
extension=memcache.so
extension=memcached.so
extension=imagick.so
extension=mongo.so
extension=mcrypt.so
I should mention that these modules are installed with Brew also. They load without issue when using PHP as an Apache module. However, when using php from the terminal, I receive the following output:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcache.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcache.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcache.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcache.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcached.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcached.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcached.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/memcached.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/imagick.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/imagick.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/imagick.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/imagick.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mongo.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mongo.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
When running:
php --ini
I receive the output:
Configuration File (php.ini) Path: /usr/local/etc/php/5.5
Loaded Configuration File: /usr/local/etc/php/5.5/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.5/conf.d
Additional .ini files parsed: /usr/local/etc/php/5.5/conf.d/ext-memcache.ini,
/usr/local/etc/php/5.5/conf.d/ext-memcached.ini,
/usr/local/etc/php/5.5/conf.d/ext-xdebug.ini
So I can see, that the loaded configuration file is the same as the one used when running as an Apache module.
Running:
php -v
gives me:
PHP 5.5.19 (cli) (built: Nov 25 2014 11:47:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
So I know it's using the correct installation (Yosemite default PHP version is 5.5.14).
I can't seem to find out why the extensions load without issue when using Apache, but not when using CLI. How do I get rid of this warning?