cPanel has started to support Apache 2.2.4 with its bleeding edge. The tragedy lies in the part that as with the previous cases of apache compilation, the new easyapache script cannot be run from shell.

It gives a screen error and hence we will have to do it the WHM way, perhaps this is the way cPanel expects this to be done, which is much to the dismay of may sys-admins like me.

I will explain the steps I followed to make cPanel run Apache 2.2.4 + php 5.2.1

One thing to be noted here is that PHP 5.1.6 / 4.4.4 should never be used due to a rook hack vulnerability. Keeping this in mind, we can start. First make sure that you upgrade cPanel version to bleeding edge via the WHM.

Before we start we need to login to the shell and delete /var/cpanel/use_old_easyapache

Next goto : WHM => Main => Software => Apache Update.

You might have to be patient for some time while apache and other related files to run easyapache are downloaded. Once this is done, you can select the previous config; switch to apache 2.2.4 and select php as 5.2.1. Make sure that you click on "configure" or else it will build the old config again. Select the wanted modules and start build. The build will almost definitely fail, and this isn't what I wanted to tell you. All that is good with this install is the Apache 2.2.4 and php 5.2.1 for the system. PHP will not work with apache and apache will keep giving you headaches.

The error at apache will be that you will constantly get : "client denied by server configuration" at the apache error logs for any page that you try to access via the apache. The fix is as below:


Open : /usr/local/apache/conf/httpd.conf

Find the lines:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

Replace this with:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

Restart apache and your error will be gone.

Second part of the problem is related to PHP not compiled with apache. Download PHP 5.2.1 from http://php.net to the server. Untar it:
tar -zxf php-5.2.1.tar.gz

cd PHP 5.2.1

Do the configure here:

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-prefix=/usr/local --enable-libxml --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql --with-mysqli --enable-exif --with-gettext --enable-safe-mode --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --enable-fastcgi --with-xmlrpc --with-zlib --with-zlib-dir=/usr/X11R6/lib --enable-calendar --enable-cgi --with-imap=shared --with-kerberos --with-imap-ssl=/usr --with-curl=/opt/curlssl/ --enable-bcmath --enable-sockets --enable-mbstring --enable-ftp --enable-discard-path


You will notice here that IMAP is compiled as a shared module unlike using "--with-imap=/opt/php_with_imap_cclient/" ; this is to avoid the error with loading php module, once the make install is done. The error was :

"/usr/lib/libc-client.so.0: undefined symbol: mm_dlog" while starting apache. The Loadmodule for php will be listed and apache will not start.

Now; once you have configured this; do :

make ; make install

and you are done compiling apache 2.2.4 with php 5.2.1.

Take good care that you DO NOT compile apache from WHM again, unless you would like to follow all these steps again, or cPanel fixes the script.


Nikhil Thomas.

Chief Consultant.

Admin-Ahead Server Technologies