PHP 4.1.0 was recently released, and it includes "Highly improved performance" and "Lots of fixes and new functions"...so I figured it was worth installing.
1. Backup httpd.conf and libphp4.so in case anything goes wrong.
CODE
cd /usr/local/psa/apache
cp conf/httpd.conf conf/httpd.conf.mybackup
cp libexec/libphp4.so libexec/libphp4.so.mybackup
cp conf/httpd.conf conf/httpd.conf.mybackup
cp libexec/libphp4.so libexec/libphp4.so.mybackup
2. Get current PHP info. Create a PHP file (phpinfo.php, for example) in the httpdocs folder of one of your domains. This file should contain:
CODE
<? phpinfo(); ?>
When you view this file through your browser (ie., http://www.yourdomain.com/phpinfo.php ), it'll show you lots of information about the PHP installation on your server. Save the output to a local file so you can compare it to similar output after the upgrade.
3. Download and compile IMAP. This is used by Webmail, so it's required by PHP...
CODE
cd /usr/local/src
wget [url]ftp://ftp.cac.washington.edu/imap/imap.tar.Z[/url]
uncompress imap.tar.Z
tar xvf imap.tar
cd imap-2001a
make slx
wget [url]ftp://ftp.cac.washington.edu/imap/imap.tar.Z[/url]
uncompress imap.tar.Z
tar xvf imap.tar
cd imap-2001a
make slx
Also, copy the IMAP client header and lib files to appropriate places, as described at http://www.php.net/manual/en/ref.imap.php:
CODE
cp /usr/local/src/imap-2001a/c-client/c-client.a /usr/lib/libc-client.a
cp /usr/local/src/imap-2001a/src/c-client/mail.h /usr/include
cp /usr/local/src/imap-2001a/src/c-client/rfc822.h /usr/include
cp /usr/local/src/imap-2001a/c-client/linkage.h /usr/include
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
cp /usr/local/src/imap-2001a/src/c-client/mail.h /usr/include
cp /usr/local/src/imap-2001a/src/c-client/rfc822.h /usr/include
cp /usr/local/src/imap-2001a/c-client/linkage.h /usr/include
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"
4. Install libiodbc, another component required by PHP.
CODE
rpm -U [url]http://www.iodbc.org/dist/libiodbc-3.0.5-1.i386-glibc21.rpm[/url]
rpm -U [url]http://www.iodbc.org/dist/libiodbc-devel-3.0.5-1.i386-glibc21.rpm[/url]
rpm -U [url]http://www.iodbc.org/dist/libiodbc-devel-3.0.5-1.i386-glibc21.rpm[/url]
5. Download and compile PHP.
CODE
cd /usr/local/src
wget [url]http://download.php.net/distributions/php-4.1.0.tar.gz[/url]
tar xvfz php-4.1.0.tar.gz
cd php-4.1.0
./configure --with-apxs=/usr/local/psa/apache/bin/apxs
--prefix=/usr/local/psa/apache --with-system-regex
--with-config-file-path=/usr/local/psa/apache/conf
--disable-debug --disable-pear --enable-sockets
--enable-track-vars --without-gd
--with-mysql=/usr/local/psa/mysql --with-iodbc=/usr/lib
--with-imap=/usr/local/src/imap-2001a
make
make install
The configuration options here are based on what was displayed in the phpinfo before the upgrade. Feel free to add other options as you feel necessary.
wget [url]http://download.php.net/distributions/php-4.1.0.tar.gz[/url]
tar xvfz php-4.1.0.tar.gz
cd php-4.1.0
./configure --with-apxs=/usr/local/psa/apache/bin/apxs
--prefix=/usr/local/psa/apache --with-system-regex
--with-config-file-path=/usr/local/psa/apache/conf
--disable-debug --disable-pear --enable-sockets
--enable-track-vars --without-gd
--with-mysql=/usr/local/psa/mysql --with-iodbc=/usr/lib
--with-imap=/usr/local/src/imap-2001a
make
make install
6. Replace the PHP module used by Apache.
CODE
/usr/local/psa/apache/bin/apachectl stop
cp -f /usr/local/src/php-4.1.0/.libs/libphp4.so /usr/local/psa/apache/libexec/
/usr/local/psa/apache/bin/apachectl start
cp -f /usr/local/src/php-4.1.0/.libs/libphp4.so /usr/local/psa/apache/libexec/
/usr/local/psa/apache/bin/apachectl start
7. View phpinfo again by visiting http://www.yourdomain.com/phpinfo.php ... It should now display the new version and other info for PHP.
8. Clean up any unnecessary files in /usr/local/src
If you come across any errors in this procedure, please let me know. There may be better ways to do some of the things I've listed...just mention it and I'll update the procedure.