After installing the latest Mac OS X Leopard security update, namely Security Update 2008-002, my Apache stopped working. Apache's error log showed the reason why:
PHP Warning: [eAccelerator] This build of "eAccelerator" was compiled for PHP version 5.2.4. Rebuild it for your PHP version (5.2.5) or download precompiled binaries.\n in Unknown on line 0
PHP Fatal error: Unable to start eAccelerator module in Unknown on line 0
Alright, the eAccelerator extension I use to speed up PHP needs to be recompiled, because the security update has upgraded PHP (from 5.2.4 to 5.2.5). Should be easy, I thought.
A few commands later I had recompiled eAccelerator and restarted Apache by toggling the Web Server option in the Sharing preference pane, and... I got the same error. So, not so easy.
Apparently Apple forgot (shame on you, Apple) to include a few updated files in the security update, required to build PHP extensions. After some trial and error I got eAcceleration compiled and working by making a few changes to the following files (use your favorite text editor, and you will need your admin password):
version="5.2.4" to version="5.2.5" andvernum="50204" to vernum="50205"#define PHP_RELEASE_VERSION 4 to #define PHP_RELEASE_VERSION 5#define PHP_VERSION "5.2.4" to #define PHP_VERSION "5.2.5" and#define PHP_VERSION_ID 50204 to #define PHP_VERSION_ID 50205After recompiling eAccelerator (you might need to run make clean before make to clean out the source directory) and restarting Apache you will have a secure PHP without sacrificing your favorite extension!
Note: other extensions may need to be recompiled too but they otherwise usually work fine without the above 'hacks'.
Update: the latest Security Update 2008-005 will update your PHP to 5.2.6, and the same instructions apply. This time, you only have to change the php_version.h, though. And of course, this time change the 4's into 6's instead of 5's.
Disclaimer: use at your own risk, I cannot be held responsible for any problems resulting from the instructions in this blog post.
Configure error after changing to php-config/php_version.h
After applying your suggested changes to php-config and php_version.h and starting from a fresh eaccelerator source directory (instead of a clean),
the ./configure throws an error after
checking target system type... i686-apple-darwin9.2.2
the error message is:
configure: error: Cannot find php-config. Please use --with-php-config=PATH
$ ls /usr/bin/php-config
/usr/bin/php-config
So the file is at that location.
Even explicitly starting the configure with that path gives an identical result:
$ sudo ./configure --with-php-config=/usr/bin/php-config
checking target system type... i686-apple-darwin9.2.2
configure: error: Cannot find php-config. Please use --with-php-config=PATH
Could someone give me a hint, how to resolve this error?
Is the problem only occurring
Is the problem only occurring after you made the changes, or are you getting the same error with the unmodified files as well?
I might be able to help if you give me the output of the following two commands:
$ ls -l /usr/bin/php-config(gives some more info about the file)$ head /usr/bin/php-config(gives the first few lines of the file)--
Dennis
The unmodified files did not
The unmodified files did not return a "Cannot find php-config" error.
$ ls -l /usr/bin/php-config
-r-xr-xr-x 1 root wheel 3031 22 mrt 21:44 /usr/bin/php-config
$ head /usr/bin/php-config
#! /bin/sh
SED="/usr/bin/sed"
prefix="/usr"
exec_prefix="${prefix}"
version="5.2.5"
vernum="50205"
include_dir="${prefix}/include/php"
includes="-I$include_dir -I$include_dir/main -I$include_dir/TSRM -I$include_dir/Zend -I$include_dir/ext -I$include_dir/ext/date/lib"
ldflags=" -L/usr/lib/mysql"
You did run phpize before
You did run
phpizebefore running./configure, right? And you are using the PHP installation that comes with the security update 002?Otherwise, I don't know how to help you, sorry.
--
Dennis
Yes, I did run phpize before
Yes, I did run phpize before ./configure
$ sudo ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-apple-darwin9.2.2
checking host system type... i686-apple-darwin9.2.2
checking target system type... i686-apple-darwin9.2.2
configure: error: Cannot find php-config. Please use --with-php-config=PATH
I did use entropy.ch php, but it seems badly uninstalled:
$ php -v
-bash: /usr/local/php5/bin/php: No such file or directory
After editing
After editing ~/.bash_profile
$ php -v
PHP 5.2.5 (cli) (built: Feb 20 2008 12:30:47)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
however ./configure still cannot find php-config
$ sudo ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-apple-darwin9.2.2
checking host system type... i686-apple-darwin9.2.2
checking target system type... i686-apple-darwin9.2.2
configure: error: Cannot find php-config. Please use --with-php-config=PATH
On another osx machine I am
On another osx machine I am able to configure and make eaccelerator, however this machine returns this error:
$ php -vdyld: NSLinkModule() error
dyld: Symbol not found: _OnUpdateBool
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
Expected in: flat namespace
Trace/BPT trapDennis, would you like to mail me your binary eaccelerator.so file?
That error only occurs when
That error only occurs when using the CLI version of PHP. Try running php_info() using a PHP script in Apache, I think it will tell you eAccelerator is working fine. You can disable eAccelerator for PHP CLI by creating a custom configuration file
/etc/php-cli.ini.I'll send you the binary, but you should be able to use the one you compiled on your other machine as well.
--
Dennis
Do you
Do you use
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.soor another extension loading line in your /private/etc/php.ini ?
I use that exact same line.
I use that exact same line.
--
Dennis
Hi Dennis, Your processor
Hi Dennis,
Your processor architecture (32-bit Core Duo) differs from mine (64-bit Core 2 Duo). This might be causing built problems for me that you will never receive.
After configuring with these parameters, the module seems to build and load:
sudo ./configure MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp' CCFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe' CXXFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe' LDFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load' --enable-shared --with-eaccelerator-userid=70Still with errors when running
make test:dyld: NSLinkModule() error
dyld: Symbol not found: _OnUpdateBool
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
Expected in: flat namespace
/bin/sh: line 1: 49230 Trace/BPT trap TEST_PHP_EXECUTABLE=/usr/bin/php TEST_PHP_SRCDIR=/Volumes/Data/Users/x/eaccelerator-0.9.5.2 CC="gcc" /usr/bin/php -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' /Volumes/Data/Users/x/eaccelerator-0.9.5.2/run-tests.php -U -d extension_dir=modules/ ` if test "x/Volumes/Data/Users/x/eaccelerator-0.9.5.2/modules/eaccelerator.la" != "x"; then for i in /Volumes/Data/Users/x/eaccelerator-0.9.5.2/modules/eaccelerator.la""; do . $i; /Volumes/Data/Users/x/eaccelerator-0.9.5.2/build/shtool echo -n -- " -d extension=$dlname"; done; fi` tests/
make: [test] Error 133 (ignored)
Yes, I had to use different
Yes, I had to use different configuration parameters on my MacBook (Core 2 Duo too) as well (I'm sitting in front of an iMac now). See http://www.veola.net/macintosh/adding-gd-library-for-mac-os-x-leopard for the best way to compile 64-bit versions of PHP modules (site down at this moment).
The
make test, like the PHP CLI, always fails.--
Dennis
thanks a lot!
thanks a lot!
you're welcome!
you're welcome!
--
Dennis
Thank you for suggesting the
Thank you for suggesting the "make clean". I had totally forgotten this on Ubuntu and was stumped as to why it was compiling the old version!
Excellent thanks! This also
Excellent thanks! This also happens on SL 10.6.8 with PHP version 5.3.4