This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

Blog About Dedicated Servers

« | »

Installing PHP5 and PHP4 together on Unix

Luigi Ramone | 15 December, 2005 19:19

So you have PHP4 working on your server, and have heard that PHP5 may break things. Here’s how to have both running alongside.


-------------------------------

#!/bin/sh
# PHP5 CGI Installer for cPanel/WHM Servers

VERSION=5.0.4
cd /usr/src
wget -O php.tbz2 “http://us4.php.net/get/php-${VERSION}.tar.bz2/from/this/mirror”
tar -xjvf php.tbz2
rm -f php.tbz2
wget http://choon.net/opensource/php/php-${VERSION}-mail-header.patch
cd php-${VERSION}
patch -p1 < /usr/src/php-${VERSION}-mail-header.patch
rm /usr/src/php-${VERSION}-mail-header.patch

PHP=/usr/local/bin/php
CFG=`$PHP -i | grep configure | sed "s/'//g" | sed "s/./configure (.*)--with-apxs.*apxs (.*)/1 2/"`
CFGLINE="${CFG##* => } —prefix=/usr/local/php5 —exec-prefix=/usr/local/php5 —program-suffix=5 —enable-force-cgi-redirect —enable-discard-path”

./configure $CFGLINE
make
make install

cp -f php.ini-recommended /usr/local/php5/lib/php.ini

cp /usr/local/php5/bin/php5 /usr/local/cpanel/cgi-sys/php5
chown root:wheel /usr/local/cpanel/cgi-sys/php5

echo “Action application/x-httpd-php5 "/cgi-sys/php5"” > /usr/local/apache/conf/php5.conf
echo “AddType application/x-httpd-php5 .php5” >> /usr/local/apache/conf/php5.conf

TEST=`grep php5.conf /usr/local/apache/conf/httpd.conf`

if [ “$TEST” = “” ]
then
echo “Include /usr/local/apache/conf/php5.conf” >> /usr/local/apache/conf/httpd.conf
echo “Your all set to restart your apache now. “
fi

-------------------------------

You’ll need to run this code with root permissions of course, save the code as a file (e.g., “php5install.sh”, CHMOD this file to 644 so it’s executable, and then run it at the command line. If you don’t know any of these things, you shouldn’t be executing this code at all.

Anyway, this should set up PHP5 without interfering without your current setup. The file extension *.php5 will be associated with PHP5.

When the script is done, simply restart Apache. On Linux type setups, it’s as simple as “service httpd restart”. Here’s a good place to begin in terms of new stuff in PHP5

Credits: SnipTools

Add comment

Topic

Text

Your name

Your email address (if any)

Your personal page (if any)


authimage




Powered by Boonic, Bloogo & pLog
This Blog does not have any affiliation nor relation with the mentioned companies. All the logotipos, trade names and images are property of the companies that registered them.