WHM 11 services series

20. How to configure PHP from within WHM

At some point in time, you'll probably need to adjust PHP's configuration options. Instead of manually editing the PHP.ini file, you can do so from within WHM.

1) Find the Service Configuration menu.

2) Click PHP Configuration Editor.

This editor has two modes -- Basic and Advanced.  In order to have access to the fullest range of options, you will need to use the advanced mode. It is available by clicking the button at the top of the page.

We recommend that you wait to change any of the advanced settings until you're certain you know what you're doing.

If ever you'd like more information about a setting, clicking a link in the Section column will take you to the PHP documentation.

The first option in Basic Mode is upload_max_filesize, which limits the maximum size of a file uploaded through PHP. This option will affect the attachment or upload system of a wide variety of software likely to be run on your server, including Joomla and vBulletin.

You'll probably want to change this to something quite a bit higher than the default. Specify a size in megabytes by using a number followed by M.

You will rarely need to change the include_path from the default.

In addition to limiting the max upload size, you can also turn off file upload altogether with the file_uploads setting. Some PHP programmers have a bad habit of using shorthand tags, which aren't enabled on many servers. This means their scripts will not function. Enable asp_tags if you encounter any scripts that require that kind of tag.

With memory_limit, you can impose a limit on the amount of memory a particular PHP script can use at any given time.

Enabling register_globals is not recommended unless absolutely necessary. It's the source of many security problems, and will be removed completely when PHP 6 is released. The max_execution_time setting prevents poorly-written scripts from tying up the server. By default, this option is set to 30 seconds; don't put this too high, or your server's performance may suffer. Similarly, max_input_time places a limit on how long a script is allowed to parse input data, such as forms and file uploads.

With enable_dl, all users can include PHP extensions at will. This represents a potential security breach, so you should turn this off unless absolutely necessary. safe_mode is another PHP option that will be removed with the release of PHP 6. It's largely ineffectual, and should probably be left off. The last option, session.save_path, controls where PHP's sessions are saved. The default should be okay for most purposes.

If you wish to change this option, you'll need to click here for the text field to appear.

3) When finished, click Save.

The php.ini file has been written automatically.

This is the end of the tutorial. You now know how to configure PHP from within WHM.