Wednesday, March 5, 2008

cPanel/WHM - Rebuilding Apache with easyapache

A common problem for most webhosts is that the server configuration needs to be changed to fit the needs of their clients. One big example of this is the plethora of PHP modules available that various people use to get things to work for their individual websites. In this article, the art of recompiling Apache web server to include these necessary PHP modules will be explained. Please be advised that Apache webserver will be down while it is recompiling

cPanel has a very handy script that will do all the recompiling for you, you just have to tell it how in a text menu. The script is called easyapache and it is available on your server in the /scripts directory. type in /scripts/easyapache to begin

When the script begins, you will be presented with a menu of what to do to get apache recompiled. Although option 6 is for 'advanced' users, it is the most helpful as you have more control over what PHP modules you will have on your server. After you have selected option 6, you will be presented with a menu with a blue background. Make sure only the following are checked (use enter or the spacebar) before proceeding:

X Expires Modules
X Raise FD_SETSIZE
X Prevent Users.... Webroots
X FrontPage
X Raise HARD_SERVER_LIMIT

X Report Build Errors
X ReWrite Module
X SSL Module
X suEXEC Module
X Verbose Build

Now, you will want to highlight "PHP Modules" and press enter, you will be presented with a bunch of different versions of PHP. Select the newest one for the major release you are currently using (4.4.x versus 5.2.x) and scroll down to select PHP Modules. The following list is fairly comprehensive, be sure not to select any modules labelled as "experimental":
BC Math
Calendar Support
Curl
Curl SSL Support
Dom XSLT
Exif
Flash
FTP
GD
GetText
Imap
MB String
MCrypt
MHash
Magic Quotes
MM
Mysql Module
OpenSSL Support
Discard Path
Pspell
Pear
Sablot XSLT
Sockets
Track Vars
Freetype Support
WDDX
XML RPC
ZLib

After you have selected all of the modules, highlight exit and press enter to get out of the PHP menu, and press enter on exit again. You will be asked if you want the current apache config to be backed up. It is ususally good to say yes here. Then, the script kicks off and begins recompiling apache.

When the script is all finished (usually takes about 30 minutes), you can verify the Apache version, PHP version, and installed PHP modules using the following three commands:
/etc/init.d/httpd fullstatus
php -v
php -m

Source: faq.cpanel.net

No comments: