Install Apache 2.4 and suPHP 0.7.2 in CWP

In this tutorial we will show you how easily you can upgrade Apache 2.2 to 2.4 and suPHP 0.7.1 to 0.7.2 in CentOS Web Panel

Lets go head with the installation:

1) Make directory for files

rm -rf /tmp/apache-build
mkdir -p /tmp/apache-build
cd /tmp/apache-build


2) Download Apache 2.4.17 , Apr 1.5.2, Apr-Util 1.5.4 and suPHP 0.7.2.


3) Extract each compressed folders one by one.

tar zxvf httpd-2.4.17.tar.gz
tar zxvf apr-1.5.2.tar.gz
tar zxvf apr-util-1.5.4.tar.gz
tar zxvf suphp-0.7.2.tar.gz


4) Install and configure Apr 1.5.2.

cd /tmp/apache-build/apr-1.5.2
make install


5) Install and configure Apr-Util 1.5.4.

cd /tmp/apache-build/apr-util-1.5.4
./configure --with-apr=/usr/local/apr/
make install


6) Install Apache 2.4.x

cd /tmp/apache-build/httpd-2.4.17
rm -rf /usr/local/apache/conf/httpd.conf
./configure --enable-so --prefix=/usr/local/apache --enable-ssl --enable-unique-id --enable-ssl=/usr/include/openssl --enable-rewrite  --enable-deflate --enable-suexec --with-suexec-docroot="/home" --with-suexec-caller="nobody" --with-suexec-logfile="/usr/local/apache/logs/suexec_log" --enable-asis --enable-filter --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --enable-headers --enable-expires --enable-proxy
make install


7) Include related files and folders.

echo "Include /usr/local/apache/conf/sharedip.conf" >> /usr/local/apache/conf/httpd.conf
echo "Include /usr/local/apache/conf.d/*.conf" >> /usr/local/apache/conf/httpd.conf 
echo "ExtendedStatus On" >> /usr/local/apache/conf/httpd.conf
sed -i "s|DirectoryIndex index.html|DirectoryIndex index.php index.html|g" /usr/local/apache/conf/httpd.conf


8) Edit /usr/local/apache/conf/httpd.conf and at the end of file add the lines below:

nano /usr/local/apache/conf/httpd.conf

<Directory "/usr/local/apache/htdocs">
        suPHP_UserGroup nobody nobody


9) Install suPHP 0.7.2.

cd /tmp/apache-build/suphp-0.7.2
yum install autoconf automake libtool -y
libtoolize --force
automake --add-missing
perl -pi -e 's#"\$major_version" = "2.2"#"\$major_version" = "2.4"#' ./configure
./configure --with-apr=/usr/local/apr/ --with-apxs=/usr/local/apache/bin/apxs --with-setid-mode=paranoid --with-apache-user=nobody --with-gnu-ld --disable-checkpath
make install


10) Enable related dependencies.

sed -i "s|User daemon|User nobody|g" /usr/local/apache/conf/httpd.conf
sed -i "s|Group daemon|Group nobody|g" /usr/local/apache/conf/httpd.conf
sed -i "s|.*modules/*||g" /usr/local/apache/conf/httpd.conf
sed -i "s|.*httpd-userdir.conf.*|Include conf/extra/httpd-userdir.conf|" /usr/local/apache/conf/httpd.conf


11) Edit /usr/local/apache/conf/httpd.conf and uncomment mod_userdir, mod_rewrite and mod_slotmem_shm.

nano /usr/local/apache/conf/httpd.conf

#LoadModule userdir_module modules/
#LoadModule rewrite_module modules/
#LoadModule slotmem_shm_module modules/


12) Start Apache.

ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd
service httpd restart


13) Configure Apache to auto start on boot.

chkconfig httpd on


14) Check apache version and modules loaded.

httpd -M
httpd -v


NOTE: Your website will show forbidden error. So you need to add a line Require all granted under each domain in /usr/local/apache/conf.d/vhosts.conf

nano /usr/local/apache/conf.d/vhosts.conf

Look for a lines below:

<Directory "/home/USER/public_html">
        AllowOverride All

Add Require all granted:

<Directory "/home/USER/public_html">
        AllowOverride All
	Require all granted

  • 7 Users Found This Useful
Was this answer helpful?