Someone posted a step by step to do it at http://forums.cpanel.net/showthread.php?t=45908 just a few hours back. There are quite a few other threads here lately that discuss this issue which you may search within the forums. I'd advise that you do it only if you really need it.x2o said:Hi I was wondering if it's possible to have php4 and 5 on the server at the same time?
#!/bin/sh
#
# Copyright (C) 2005 Richard Gannon. All rights reserved.
#
# Author: Richard Gannon
#
# This script will install PHP5 as a CGI on a cPanel server using the same configure
# selections as the already built PHP4. You can have PHP scripts utilize the PHP5
# engine by using the .php5 extension.
#
# Version 1.1
#
##
PHP_VERSION=5.0.5
WGET=/usr/bin/wget
GREP=/bin/grep
TAR=/bin/tar
AWK=/bin/awk
cd /usr/src
$WGET -O php.tbz2 http://php.net/get/php-${PHP_VERSION}.tar.bz2/from/this/mirror
$TAR -xjvf php.tbz2
rm -f php.tbz2
$WGET http://choon.net/opensource/php/php-${PHP_VERSION}-mail-header.patch
cd php-${PHP_VERSION}
patch -p1 < /usr/src/php-${PHP_VERSION}-mail-header.patch
rm -f /usr/src/php-${PHP_VERSION}-mail-header.patch
if [ -e /usr/local/bin/php ]; then
PHP=/usr/local/bin/php
else
PHP=/usr/bin/php
fi
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
PHP5CONF=`$GREP php5.conf /usr/local/apache/conf/httpd.conf`
if [ "$PHP5CONF" = "" ]; then
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
echo "Include /usr/local/apache/conf/php5.conf" >> /usr/local/apache/conf/httpd.conf
fi
CONFIGTEST=`/etc/init.d/httpd configtest | $GREP -m1 Syntax | $AWK '{print $2 }'`
if [ "$CONFIGTEST" = "OK" ]; then
echo "Restarting Apache now..."
/etc/init.d/httpd restart
echo "Done. Enjoy PHP5!"
else
echo "There may have been a problem with this installation."
echo "Please check the httpd.conf for syntax with '/etc/init.d/httpd configtest'"
fi
exit 0
Your script works great, thanks for posting itBlue|Fusion said:I also wrote a small script to automatically install PHP5 as a CGI using the same configuration as the already installed PHP4 module. Not really released to public (I just use it on my own servers to keep PHP4 and PHP5 running along side eachother), but here ya go anyway. I'm planning on putting it in my LES program soon, anyway.
How do I do this? Can someone explain?Blue|Fusion said:I also wrote a small script to automatically install PHP5 as a CGI using the same configuration as the already installed PHP4 module. Not really released to public (I just use it on my own servers to keep PHP4 and PHP5 running along side eachother), but here ya go anyway. I'm planning on putting it in my LES program soon, anyway.
Code:#!/bin/sh # # Copyright (C) 2005 Richard Gannon. All rights reserved. # # Author: Richard Gannon # # This script will install PHP5 as a CGI on a cPanel server using the same configure # selections as the already built PHP4. You can have PHP scripts utilize the PHP5 # engine by using the .php5 extension. # # Version 1.1 # ## PHP_VERSION=5.0.5 WGET=/usr/bin/wget GREP=/bin/grep TAR=/bin/tar AWK=/bin/awk cd /usr/src $WGET -O php.tbz2 http://php.net/get/php-${PHP_VERSION}.tar.bz2/from/this/mirror $TAR -xjvf php.tbz2 rm -f php.tbz2 $WGET http://choon.net/opensource/php/php-${PHP_VERSION}-mail-header.patch cd php-${PHP_VERSION} patch -p1 < /usr/src/php-${PHP_VERSION}-mail-header.patch rm -f /usr/src/php-${PHP_VERSION}-mail-header.patch if [ -e /usr/local/bin/php ]; then PHP=/usr/local/bin/php else PHP=/usr/bin/php fi 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 PHP5CONF=`$GREP php5.conf /usr/local/apache/conf/httpd.conf` if [ "$PHP5CONF" = "" ]; then 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 echo "Include /usr/local/apache/conf/php5.conf" >> /usr/local/apache/conf/httpd.conf fi CONFIGTEST=`/etc/init.d/httpd configtest | $GREP -m1 Syntax | $AWK '{print $2 }'` if [ "$CONFIGTEST" = "OK" ]; then echo "Restarting Apache now..." /etc/init.d/httpd restart echo "Done. Enjoy PHP5!" else echo "There may have been a problem with this installation." echo "Please check the httpd.conf for syntax with '/etc/init.d/httpd configtest'" fi exit 0