Installing PHP 5.3.0 on Zend Server CE 4 on Mac OSX 10.5 Leopard
Posted: July 2nd, 2009 | Author: Mihai Bojin | Filed under: General, PHP, Troubleshooting, zend framework | Tags: libmysqlclient, mac osx, PHP, php 5.3.0, zend, zend server, zend server ce |As you already know PHP 5.3.0 is out, with lots of interesting features like namespaces and closures and other cool stuff !
I wanted to give it a try but I also meant to keep my existing Zend Server CE 4 installation.
Because of that I had to compile the new PHP 5.3.0 on my Leopard based Mac…
Find out why an apparently easy task has taken me over 2 hours of debugging, below !
Compiling PHP 5.3.0 proved somewhat difficult as I ran into a number of problems like MySQL 32/64 bits architecture, not finding a libraries like libxml in the system, other 32/64 bits incompatibilities and so on.
My troubles started because I had a 64bit MySQL version installed on my Mac (it came with the system) ! PHP itself compiles as 32bits and if you try to compile it on 64bits you will run into other library incompatibilities (btw, can’t wait for Snow Leopard to come out… all will be 64bits !).
After figuring that out, the rest was preety easy to fix !
I will tell you the exact steps you need to make in order to install PHP 5.3.0 over your Zend Server CE 4 on the Mac OSX 10.5 Leopard operating system:
- download PHP 5.3.0
- download the latest MySQL Community Server from Mysql (I used 5.1.36)
- open up a Terminal window and go into super user mode (sudo su and enter your login password)
- move the downloaded mysql archive to /usr/local (mv /Users/[your_username]/mysql-5.1.36-osx10.5-x86.tar.gz /usr/local/)
- run cd /usr/local
- run tar xzf mysql-5.1.36-osx10.5-x86.tar.gz
- move the downloaded php archive to /usr/local (mv /Users/[your_username]/php-5.3.0.tar.gz /usr/local/)
- run tar xzf php-5.3.0.tar.gz
- run cd php-5.3.0
- run the following configure command:
UPDATE: Download the configure command for PHP 5.3.0 from here (because FCKEditor keeps replacing — with -)
- run make
- run make test
- If you get an error about libmysqlclient.16.dylib not beeing of the correct architecture do the following two steps:
- [optional] run rm /usr/local/mysql/lib/libmysqlclient.16.dylib
- [optional] run ln -s /usr/local/mysql-5.1.36-osx10.5-x86/lib/libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib
- run make install
- exit super user mode by running: exit
- run apachectl restart
- at this point you should have PHP 5.3.0 running
Hope this quick tutorial helps you, as I’ve spent around 2-3 hours figuring out all the crap MacOSX has thrown at me !
I ran into a different problem afterwards, namely Zend Framework 1.8, PHP 5.3.0 and Zend_Cache do not work together out of the box and spit out this error message: "set_magic_quotes_runtime() is deprecated"; see this fix here !
If you have any problems or you would like to share your experience with installing or using PHP 5.3.0, know that your comments are welcome !











[...] posted here: Installing PHP 5.3.0 along Zend Server CE 4 on Mac OSX 10.5 … Posted in Object, Web Design. Tags: funny, games, general, google, iphone, mac-osx, mihai-bojin, [...]
Hi,
First of all, thanks for posting this. Been searching for a clear walkthrough on how to get PHP 5.3 running on my Mac.
Now, the problem I encounter while compiling PHP is the following:
checking for Apache 2.0 handler-module support via DSO through APXS…
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using –with-apxs2=/path/to/apxs
3. Apache was not built using –enable-so (the apxs usage page is displayed)
The output of /Applications/ZendServer/apache2/bin/apxs follows:
./configure: line 6548: /Applications/ZendServer/apache2/bin/apxs: No such file or directory
configure: error: Aborting
Do you have any solution regarding this error? I’m in desperate need of it..
Thanks!
Hello !
For me it worked because I used the apxs that came with ZendServer.
Try replacing this line
‘–with-apxs2=/Applications/ZendServer/apache2/bin/apxs’
with
‘–with-apxs2=/usr/sbin/apxs’
in your configure command,
run make clean
and then run make again.
Tell me if it worked out !
Hmm, same error except with the newly given path.. I did a fresh install of Zend Server CE just before trying your steps described above, I haven’t changed anything about the setup of Zend Server CE..
Any other thoughts on this?
Nevermind, made a typo (aspxs instead of apxs).
Now when running “make test” i get the error:
Build complete.
Don’t forget to run ‘make test’.
dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib
Referenced from: /usr/local/php-5.3.0/sapi/cli/php
Reason: image not found
/bin/sh: line 1: 46106 Trace/BPT trap TEST_PHP_EXECUTABLE=/usr/local/php-5.3.0/sapi/cli/php TEST_PHP_SRCDIR=/usr/local/php-5.3.0 CC=”gcc” /usr/local/php-5.3.0/sapi/cli/php -n -c /usr/local/php-5.3.0/tmp-php.ini -d ‘open_basedir=’ -d ‘output_buffering=0′ -d ‘memory_limit=-1′ /usr/local/php-5.3.0/run-tests.php -n -c /usr/local/php-5.3.0/tmp-php.ini -d extension_dir=/usr/local/php-5.3.0/modules/ ` if test “x/usr/local/php-5.3.0/modules/openssl.la /usr/local/php-5.3.0/modules/zlib.la” != “x”; then for i in /usr/local/php-5.3.0/modules/openssl.la /usr/local/php-5.3.0/modules/zlib.la”"; do . $i; /usr/local/php-5.3.0/build/shtool echo -n — ” -d extension=$dlname”; done; fi; if test “x” != “x”; then for i in “”; do . $i; /usr/local/php-5.3.0/build/shtool echo -n — ” -d zend_extension=/usr/local/php-5.3.0/modules/$dlname”; done; fi`
make: [test] Error 133 (ignored)
When i try the two optional steps as you describe i get the error:
rm: /usr/local/mysql/lib/libmysqlclient.16.dylib: No such file or directory
and
ln: /usr/local/mysql/lib/libmysqlclient.16.dylib: No such file or directory
Sorry for bothering but I’m completely new to all this!
It appears that /usr/local/mysql/ doesn’t exist..
MySQL seems to be installed to /usr/local/zend/mysql !
I ran into this problem myself and the solution, although it now seems logical, came to me after around 1 hour of trying different strategies.
By default you probably have a 64bit version on your Mac OSX system. If you cannot use the version that came with ZendServer CE do the following:
Download the latest 32 bit Mysql server, untar it in /usr/local/lib and then pass that dir as a parameter into ./configure.
You will probably get similar errors with gd, because you do not have libjpeg and libpng installed in /usr/local/lib.
Download them from
http://www.ijg.org/files/jpegsrc.v7.tar.gz
and
http://sourceforge.net/projects/libpng/files/libpng-stable/libpng-1.2.37.tar.gz/download
untar them into /usr/local/lib and pass those as parameters into ./configure.
Try Zend Server CE 4.0.5 Early Access
works well on MacOSX and CentOS 5.3 x86_64