How to upgrade PHP in SME Server v5.1.2

Author: Dan Brown <dan@familybrown.org >
Contributors: Charlie Brady <mailto:charlieb@e-smith.com>, David M. Brown <dbrown@ffj.yi.org >

Problem:
You need to upgrade PHP on e-smith to a newer version to support a new PHP program's minimum install requirements. At the time of writing this HowTo the current PHP version available from Red Hat source code was 4.1.1-2. These instructions should work on any stock SME Server v5.0 or v5.1.2, but have only been tested on v5.1.2.

Solution:

If you're using SME Server v5.0, you'll need a couple of additional libraries that are not included with this version. To retrieve and install them, run the following commands:

[root@e-smith /root]# mkdir expat
[root@e-smith /root]# cd expat
[root@e-smith expat]# wget ftp://rpmfind.net/linux/redhat/7.1/en/os/i386/RedHat/RPMS/expat-1.95.1-1.i386.rpm
[root@e-smith expat]# wget ftp://rpmfind.net/linux/redhat/updates/7.1/en/os/i386/mm-1.1.3-2.i386.rpm
[root@e-smith expat]# rpm -Uvh *


Issue the following commands (note that rpm -Fvh will only update the RPMS that are currently installed on your system):

[root@e-smith /root]# mkdir php412
[root@e-smith /root]# cd php412
[root@e-smith php412]# ARCH=i386
[root@e-smith php412]# DB=ftp://ftp.e-smith.org/pub/e-smith/contrib/DanBrown/RPMS/$ARCH

[root@e-smith php412]# wget $DB/php-4.1.2-2es.$ARCH.rpm \

$DB/php-mysql-4.1.2-2es.$ARCH.rpm \

$DB/php-imap-4.1.2-2es.$ARCH.rpm \

$DB/php-ldap-4.1.2-2es.$ARCH.rpm \

$DB/php-pgsql-4.1.2-2es.$ARCH.rpm

[root@e-smith php412]# rpm -Fvh *

Note that there are also versions of these RPMs for i586 and i686. The i386 versions will work on these processors, but the i586 and i686 versions are optimized for them, and should offer improved performance. To retrieve those, replace i386 with i586 or i686 in the ARCH= statement above. If you have a Pentium (or equivalent) processor, use ARCH=i586. If you have a Pentium Pro, II, III, or 4 (or equivalent), use ARCH=i686.

Next, we will edit php.ini a little to clean things up. Issue the following command:

[root@e-smith php412]# pico -w /etc/php.ini

PHP 4.1.1 doesn't like some of the database calls that IMP uses, even though they still work. To avoid having errors clutter up your screen, you'll want to find the line that says display_errors and set that to Off . If you want them to be logged, set log_errors to On , and error_log to syslog.

[root@e-smith php412]# /etc/e-smith/events/actions/restart-httpd-full

At this point, you're done. If you want to make sure it's working properly, then create a file in /home/e-smith/files/primary/html called test.php, and include the following line:

<? phpinfo(); ?>

Then point your web browser to http://yourserver/test.php. You should get a colorful screen indicating PHP version 4.1.1, and (among other things) support for IMAP, LDAP, and MySQL. If you're paranoid about security, it'd be a good idea to remove this file once you're satisfied that everything is working, as it exposes many details about your system configuration.

If you just saw the PHP source for that page, you need to upgrade your e-smith-base package. You can find instructions at http://www.e-smith.org/bugs/index.php3?op=showBug&bugID=27

NOTE:
The RPMs installed by this procedure conflict with (and supersede) SMEServer-5.0_Update4, SMEServer-5.1.1_Update1, and SMEServer-5.1.2_Update1. They should install without errors, but those blades will then show as "Not Installed" in your Blades panel.



Copyright © 2002 Dan Brown. This document may be freely redistributed so long as this notice remains intact.