You can use this script to install suphp in cpanel server.
#!/bin/bash
DIR=/usr/local/src
INSPATH=”/opt/suphp”
#$1=$CUS
CMDOPT=”–prefix=/opt/suphp –with-apr=/usr/local/apache/bin/ –with-apxs=/usr/local/apache/bin/apxs –with-logfile=/usr/local/apache/logs/suphp_log $CUS”
#checkig previous easyapache profile
if [ -e “/opt/suphp” ] || [ -e “/usr/local/apache/modules/mod_suphp.so” ]; then
echo “Suphp already installed. Exiting…..!!!”
exit 1
fi
last_ok_file=”/var/cpanel/easy/apache/profile/_last_success.yaml”
if [ -e “$last_ok_file” ]; then
EPHPAsUser=`grep “PHPAsUser:” $last_ok_file | cut -d: -f2|sed ‘s/ //g’`
if [ “$EPHPAsUser” -ne 1 ]; then
sed -i ‘s/PHPAsUser: 1/PHPAsUser: 0/g’ $last_ok_file
echo “corrected easyapache profile”
fi
fi
echo “Downloading Source from repository”
/usr/bin/wget -q -O $DIR/PHPAsUser.tar.gz http://prajith.in/cpanel/suphp/PHPAsUser.tar.gz
if [ ! -f $DIR/PHPAsUser.tar.gz ];
then
echo “unable to download source from repository Exiting….!!!”
exit 1
fi
cd $DIR
/bin/tar -zxf PHPAsUser.tar.gz
cd suphp-0.7.1/
#Applying cpanel patch
/usr/bin/patch -p1 < cppatch/01_suphp_paths.patch
/usr/bin/patch -p1 < cppatch/02_suphp_userdir.patch
/usr/bin/patch -p1 < cppatch/03_suphp_full_php_process_display.patch
/usr/bin/patch -p1 < cppatch/04_suphp_paranoid_checks.patch
/usr/bin/patch -p1 < cppatch/05_suphp_phprc.patch
/usr/bin/patch -p1 < cppatch/06_suphp_ruid2.patch
#startng compilation
/bin/sh configure $CMDOPT && make && make install
sleep 0.5
mkdir /opt/suphp/etc
cp -pr cppatch/suphp.conf /opt/suphp/etc/
ESUPHP=`/usr/local/cpanel/bin/rebuild_phpconf –current|grep “Available handlers:”|awk ‘/suphp/ {print $1}’`
if [ “$ESUPHP” != “Available” ]; then
echo “hmmm cannot find suphp handler, compile easyapache and enable”
exit 1
fi
echo “Inastallation completed……”
echo “To enable Suphp Login to WHM >> Service Configuration >> Configure PHP and SuExec and change PHP 5 Handler to suphp”
exit 1
Don’t copy paste the above script directly. Just use given command to download.
wget -O suphpinstall.sh prajith.in/cpanel/suphpinstall.sh
Hello Prajith,
I just wondering the need of this installation, when the cPanel server comes with suPHP enabled by default. Even if it is not enabled you can do that by WHM>>Main >> Service Configuration >> Configure PHP and SuExec and just select suPHP in PHP5 handler.
Correct me if I am wrong or if this is something different?
Thanks,
Sathyavrathan PK
SUPHP is not enabled in cpanel by default, to enabled this we need to run easy apache, once it is completed we can switch the apache Handler to SUPHP via WHM>>Main >> Service Configuration >> Configure PHP and SuExec and just select suPHP in PHP5 handler.
Thank you for the clarification 🙂