Compiling PHP under OpenSolaris
As I switched my main system recently from Linux to OpenSolaris I compiled PHP. Quiet obvious things are a little bit different on Solaris. The usual ./buildconf && ./configure && make install doesn’t work anymore. The good news: It’s not much harder. Let’s start to get the prequisites:
~# pkg install SUNWgm4 SUNWaconf SUNWgmake SUNWgcc SUNWbison
Finally we have to get the latest re2c sources. Re2c is needed to regenerate PHPs parsers but not yet available in OpenSolaris official package repository. So go to re2c at sourceforge and download the most recent sources.
~$ gtar xzvf re2c-0.13.5.tar.gz
~$ cd re2c-0.13.5/
The other necessary GNU tools should be installed, otherwise try to install SUNWgnu-coreutils. So let’s get our CVS snapshot and compile it:
~$ cd php-src-5.3/
~$ MAKE=gmake ./buildconf
~$ ./configure RE2C=”~/dev/c/re2c-0.13.5/re2c”
~# gmake install
As we have to use GNUs make and not Solaris make implementation we have to set the MAKE environment variable used by buildconf. Since re2c is not in our path (we didn’t installed it), we pass the location of the re2c executable to the configure script with the RE2C env variable. After successfully executing gmake install, we have our PHP 5.3 installed.
~$ php -v
PHP 5.3.0alpha3-dev (cli) (built: Sep 30 2008 02:37:10)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
Please notice that PHP’s default configuration is to install the binaries in /usr/local/bin. This directory is usually not in $PATH, so update your PATH.
As pointed out in the OpenSolaris Forums GNU make is just required for the buildconf step, so you should be able to use Solaris make implementation if you don’t compile from CVS sources.