I have three installed versions of php on my Mac. When I check using phpinfo() via a web browser, the one that is being invoked is version 5.3.15. I would like to switch it to the installed instance that is version 5.4 for the apache module (not needed for the CLI).
The reason I would like to do this is because I have used MacPorts to install php_geoip, but it is for the 5.4 version.
When I use "which" I see the following:
$ which -a php /opt/local/bin/php /usr/bin/php $ which -a php54 /opt/local/bin/php54
Then checking the version of each of these gives the following:
$ /opt/local/bin/php --version PHP 5.3.19 (cli) (built: Dec 15 2012 01:08:10) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans $ /usr/bin/php --version PHP Warning: PHP Startup: geoip: Unable to initialize module Module compiled with module API=20100525 PHP compiled with module API=20090626 These options need to match in Unknown on line 0 PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.0-komodo, Copyright (c) 2002-2012, by Derick Rethans $ /opt/local/bin/php54 --version PHP 5.4.10 (cli) (built: Dec 20 2012 19:30:08) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Please note that the CLI version checks are only being used to determine the version of each instance. It is actually the proper version of the apache module libphp5.so that I will ultimately need to get working.
As you can see from the above, there is an error message from the 5.3.15 instance which I believe comes from my efforts to try to load geoip.so, as follows:
; 2013-01-10 enable geoip extension="/opt/local/lib/php54/extensions/no-debug-non-zts-20100525/geoip.so"
In other words, I used MacPorts to install php_geoip, and as a part of that it installed the dependence of php54, because the version of geoip.so in the MacPorts ports tree needs php 5.4. I tried making the running php 5.3.15 load geoip.so from the php 5.4 instance, but it does not work, as the error message shows.
Next I tried switching the instance of php to version 5.4 by changing the LoadModule statement as shown here:
# 2012-10-28: enable php # LoadModule php5_module libexec/apache2/libphp5.so # 2013-01-13: change to more recent version of installed php - does not work LoadModule php5_module /opt/local/apache2/modules/libphp5.so
However, this prevents php from working at all.
So to solve my problem, I either need to get a php 5.3.15-compatible version of geoip.so, or cause my system to use the php 5.4 instance. Any guidance on either of these approaches is appreciated.