Apache/PHP Configuration under cPanel

cPanel makes use of it's proprietary “EasyApache” system for manging Apache and PHP (and related modules). It is currently in it's third iteration, commonly referred to as EA3. EA3 allows you to easily enable support for all kinds of Apache and PHP modules, as well as upgrade/downgrade versions for both.

Getting Started

The EA3 system can be invoked by two different methods. The first is through the WHM under Main » Software » EasyApache (Apache Update). The other is through SSH by running the script /scripts/easyapache from a root-level SSH session. Both will present you with the same screen; the WHM version is shown below:

&direct |EasyApache Initial Screen

You can select any one of the build options listed on this screen and select Build Profile Now and the system will automatically rebuild Apache+PHP based on that profile. Click the More Info link next to the profile for more information on what it builds.

Custom Configuration

Generally speaking, however, you will want to add a custom set of Apache or PHP modules. The first step is to leave the “Previously Saved Config” option checked, and hit Start customizing based on profile.

This will lead you through a series of steps. The first is to select your Apache Version, which we always recommend the latest, currently Apache 2.2.1)

Next, you will chose your PHP major version. Here you can also select both PHP4 and PHP5 to run simultaneously, however this requires additional server configuration which is outside of the scope of this article. We strongly recommend PHP5.2)

On the next screen you will select your Minor PHP version. Generally speaking you want to go with the latest available version, however you should check PHP's changelog to ensure the latest version does not have any major changes that will not break your scripts. If you find that it does, you can always run EasyApache again and downgrade a version.

On the next and final screen, you will find the options for Apache and PHP when it comes to modules, loaders, and the like. This screen only lists the most commonly selected options, and for a more complete list hit the Exhaustive Options List button. This will also take you to the list of all the Apache and PHP modules which cPanel's EA3 system supports.

You will find the most common PHP modules here, however if you find that the one you are looking for is not supported, you may want to consider using a PEAR module, otherwise you can add custom compilation options according to cPanel's guide found here.

Followup

Once you have selected Save and Build the rebuild process with begin. cPanel builds from source, so the process generally takes anywhere from 15-30 minutes, depending on the speed of the server hardware. The webserver continues to function while the build happens in the background. Only near the end of the build process is the webserver stopped and the new build put in place.

EA3 will rarely leave you with a broken system should the build fail for some reason. If it does indeed fail, it will automatically revert to the previously saved (and working) build.

If the build completes successfully and you did not select a new PHP loader (such as SuPHP), then you are all set! If you did select a new loader, you will need to specify it as the default in Main » Service Configuration » Apache Configuration » PHP and SuExec Configuration.

1)
Important: If you must run PHP4 (not recommended), you should use Apache 1.3.