Canonical Way to Build PHP 5.4 on Solaris 11


You need gnu-coreutils installed.
$ wget -O php.tar.bz2 http://us.php.net/get/php-5.4.3.tar.bz2/from/this/mirror
$ tar xvjf php.tar.bz2
$ cd php-5.4.3
$ ./configure \
--with-apxs2=/usr/apache2/2.2/bin/apxs \
--prefix=/usr/php/5.4 \
[other options]
$ gsed -ibak 's,\-mt,,' Makefile
$ gsed -i.bak 's,\-i \-a \-n php5 libphp5\.la,-i -n php5 libphp5.la,' Makefile
$ make -j4
$ sudo make install
$ vim /etc/apache2/2.2/conf.d/php5.2.conf
..change stuff to libphp5.la..
$ svcadm restart apache22

Worked for me so far.

4 Comments

  1. stephane says:

    did you tryed to compile with intl (php 5.4.7)

    i have the following error:

    Unable to load dynamic library ‘/root/intl/intl-2.0.1/modules/intl.so’ – ld.so.1: php: fatal: relocation error: file /root/intl/intl-2.0.1/modules/intl.so: symbol _ZTVN6icu_4913FieldPositionE: referenced symbol not found in Unknown on line 0

    Regards

    -Stéphane

  2. Hi,
    This is an awesome post. Very helpful. I do want to ask a question. I used AMP to install Apache, PHP, and MySQL. This is installed a little messy. Bin files in one area, while mods in another, and the root somewhere else. The process completed fine up to make -j4. I even tried make -j 4 (space). I actually completed the rest of the steps successfully. Since AMP installed in several locations I decided to edit the paths in the httpd.config file to the php5.4 bin. I am still showing php 5.2. Could this error have something to do with this?

    Thanks in advance.
    Tony

    • dsp says:

      Maybe your apache is using mod_php? Often mod_php is installed as mod_php5.so while it’s called libphp5.so if you build it from source. Make sure your module config has the right name in it.

Leave a Reply