≡ Menu

source code

Install PHP 5 on Red Hat Enterprise Linux version 4

It appears that many people or sys admin want to run php 5 on Red Hat Enterprise Linux. Unfortunately Redhat does not provide this package (RPM file) for RHEL. You can download source code and install php 5 from official php site. This requires compiler collection on your system. Download source code and just follow instructions presented in INSTALL or REDME file.

Another option is search and installs PHP 5 packages. You can download x86_64 PHP 5 package here. Use wget command to download these packages and rpm command to install new packages. But first remove old php4 package using rpm -e command.

Alert: This post is outdated. Please use the latest version of RHEL/CentOS v6.x+ for PHP 5.x. The author no longer support php 5 rpm on RHEL 4.x.

However these rpm packages 64 bit so if you are running 32 bit os rebuild RPM file.

Step # 1: Download src rpm

# cd /tmp
# wget http://www.cyberciti.biz/files/lighttpd/rhel4-php5-fastcgi/php-5.1.4-1.esp1.src.rpm
# rpm -ivh php-5.1.4-1.esp1.src.rpm

Step #2: Rebuild RPM for 32 bit RHEL version

# cd /usr/src/redhat/SPECS
# rpmbuild -bb php.spec

It will take some time to compile and rebuild RPM files.

Step #3: Install new php5 RPM file

Remove old php4 rpm. Go to /usr/src/redhat/RPMS directory and install PHP5 RPM files.

Please note that PHP 5 is not official supported by Red Hat on RHEL 4.0. You are using these packages on your own risk ;)

Howto: Verify integrity of the tar balls or source code

Verifying integrity of the tar balls or source code is an essential step, which makes sure that you are going to use guanine software (also know as checksum). Every Linux or UNIX admin should be aware of this test. However, what is a checksum? A checksum is a form of a very simple measure for protecting the integrity of data from both hackers (read as crackers) and data transmission error over network i.e. make sure no one has tampered with a source file (see checksum @ wikipedia) For file verification, use any one of the following command:

  1. sha1sum - check SHA1 (160-bit) checksums
  2. md5sum - check MD5 (128-bit) checksums
  3. gpg - Use to validate a GPG certificate

Therefore, whenever you visit source-code download site, you will come across md5sum, sha1sum, or gpg signature keys listed. Following is general syntax to verify keys with different commands:

  • sha1sum {source-code-file-name}
  • md5sum {source-code-file-name}
  • gpg --verify {source-code-file-name.sig} {source-code-file-name}

Examples ~ sure, without examples no one able to grasp the idea: