Introduction
This HOWTO details the steps I took to upgrade two (going on three) RAQ550 machines and one Qube 3 to PHP 4.3.x, and is presented more for my own future reference than as a compreehensive setup guide.
DISCLAIMER: Following this procedure will invalidate your warranty. This is not a supported upgrade path, and if you decide to do this, you're on your own. Some people have broken their administrative interface by overlooking a couple of steps and/or failing to make backups of the original Cobalt files - you have been warned.
The base procedure can be outlined as follows:
- Make httpd.admserv fully independent
- Get the PHP sources and any dependent libraries you might need
- Compile PHP for the Cobalt layout
- Enjoy
Isolating the admin server
Go to /usr/lib and copy /usr/lib/apache to /usr/lib/apache.admserv. For good measure, make another copy called apache.orig, since you will change the apache directory contents as well later on, and backups are always nice to have:
# cd /usr/lib # cp -R apache apache.admserv # cp -R apache apache.orig
Now let's make the administration server use the new apache.admserv directory: Edit the administration server's httpd.conf file to load the PHP module from /usr/lib/apache.admserv/libphp4.so. The relevant line in the file should look like this:
# cat /etc/admserv/conf/httpd.conf | grep LoadModule | grep -i php4 LoadModule /usr/lib/apache.admserv/libphp4.so
Now PHP has to be configured to load the custom cce.so extension. Edit the administration server's php.ini file to load extensions from /usr/lib/apache.admserv/php.
This is different from the /etc/httpd/php.ini file used by the hosted sites, since the startup scripts for each web server set the PHPRC environment variable (reading through /etc/rc.d/init.d/httpd and /etc/rc.d/init/admserv is strongly recommended for those who want to compare the hosting web server with the admin server).
Again, the relevant line is:
# cat /etc/admserv/php.ini | grep extension_dir extension_dir = /usr/lib/apache.admserv/php
Not test it by restarting httpd.admserv:
# /etc/rc.d/init.d/admserv restart
And test it by going to the administration front-end. So far, everything you have done is easily reversible, and the hosted web sites are still running from /usr/lib/apache.
Information on recompiling PHP was axed from the Sun Knowledge Base, so here are the command lines I used:
# cd /root/Packages # tar -zxvf php-4.3.2.tar.gz # mv php-4.3.2 /usr/src/ # wget http://planetmirror.com/pub/sourceforge/libpng/libpng-1.2.5.tar.gz # mkdir ../Build # cd ../Build/ # tar -zxvf ../Packages/libpng-1.2.5.tar.gz # cd libpng-1.2.5/ # cp scripts/makefile.linux Makefile # make install # cd ../../Packages/ # wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz # cd ../Build/ # tar -zxvf ../Packages/jpegsrc.v6b.tar.gz # cd jpeg-6b/ # ./configure ; make # make install # make install-lib # make install-headers
I then searched for libttf - don't remember if it's already installed on the 550, but I recompiled the new version on the Qube without any issues - and proceeded to recompile PHP with the following command line (you can get the command-line used to compile any version of PHP by reading the phpinfo() output - check your PHP manual).
# cd /usr/src/php-4.3.3/ # ./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --enable-safe-mode \ --with-config-file-path=/etc/httpd/ --with-exec-dir=/usr/bin --with-zlib \ --enable-magic-quotes --with-regex=system --with-pear --enable-calendar \ --with-gd --with-iconv --disable-debug --with-gettext \ --with-ttf=/usr/lib/libttf.so --enable-mbstring --with-interbase=shared \ --with-mysql=shared --with-pgsql=shared --with-jpeg=/usr/local/lib \ --with-png=/usr/local/lib # make # make install # cp modules/* /usr/lib/apache/php/ # /etc/rc.d/init.d/httpd restart
I then proceeded to change php.ini to my settings, takink special care to change the extension_dir to the new one PHP creates upon installation. I have also added Turck MMCache to all installations with great results.
Note: If you have installed any Apache or PHP updates from Cobalt (at least any after June 2003), it might actually be a good idea to rename /usr/lib/apache temporarily to something else and make doubly sure that the administration server is not using anything in that directory - any new updates or third-party extensions may well add more stuff to that directory that I'm not aware of.