Changing your PHP version, modules, settings and functions

PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor.

PHP is a programming language and forms the basis of many modern content management systems like WordPress, Joomla and Drupal.

This article describes how to change a cPanel account's PHP version, add or remove PHP modules, change PHP options and how to enable functions. All actions are completed within cPanel for the domain you wish to change.

PHP settings apply for the whole cPanel account - including any addon, alias and subdomains. So, if you have multiple sites running on different domains within the same account please be sure to test them all thoroughly when changing the PHP version or making other changes. You can switch back to a previous PHP version if there's a problem.

PHP settings are accessed via cPanel > Software > Select PHP Version

Changing your PHP version

When you click 'Select PHP Version' you will be presented with the PHP Selector extensions page. The option to change PHP version is the drop-down at the top left - once you've selected the version you require, click 'Set as current'. Changing the PHP version is also available at the top of the PHP Selector options page - and works in the same way.

Whilst we would always recommend running the latest version of PHP possible (v7.x has significant performance improvements over v5.x - so you could get a 'free' website speed boost just by changing) - we do also offer hardened and security patch maintained older versions if your website requires them.

Changing PHP Modules/Extensions

What is a PHP extension?

A PHP extension, as its name suggests, extends the PHP language with more functions. For example, the gmagick extension provides a range of PHP functions relating to image manipulation. If you attempt to use any of these functions without activating this extension then your pages will return an internal server error.

For example, Magento has a list of required PHP Extensions listed including DOM, and soap, which may not be enabled by default for your account.

Enabling and disabling a module/extension

Depending on the PHP version you select you will see the modules/extensions available, with the default modules for that version selected. You can see them for PHP 5.6 in the screenshot above. You can enable modules by ticking, disable by unticking - changes will automatically save.

Selecting unnecessary PHP extensions to load at run-time can adversely affect the performance of your website because the server has to open more files in order to process your scripts.

However, this functionality should be used with care. Selecting incompatible extensions (for example, the apc extension should not be used with PHP 5.4 and above) can cause intermittent or permanent errors or performance degradation.

Conversely, failing to select PHP extensions that are required by your web application can cause server errors and prevent it from working at all.

IonCube loader is required for WHMCS - you can enable that here.

Changing PHP options

The PHP Selector options page allows you to easily change a number of the common php.ini settings, without having to edit the php.ini file.

You can switch to the PHP Selector options page by clicking the link 'Switch to PHP Options' at the top of the PHP Selector extensions page. Once on the PHP Selector options page this link changes to 'Switch to PHP Extensions'.

To change an option you need to click on it's value e.g. to change allow_url_fopen you would click on 'On' - this will then either show you a drop-down of choices or allow you to edit the field depending on the option. Click 'Apply' next to the field and then 'Save' to make any change.

Unless you have a specific issue the default settings are normally fine.

Please read the following section for more details on changing disabled_functions.

Enabling PHP functions

By default a number of PHP functions are disabled. They can be found in the disabled_functions option.

To enable a function you should remove it from this comma separated list. Clicking over the disabled functions will enable a small editing window. Be careful to ensure you don't leave any spaces and that there are single commas between each remaining function. Click outside the field or navigating away will save any changes.

IMPORTANT SECURITY NOTE : To avoid compromising security, disable_functions should only be changed with caution and only if you are sure of what you are doing. Modern PHP web applications intended for shared hosting environments are unlikely to need any adjustments to this setting. Please ask for advice if you are unsure.

php.ini files

Any php.ini files that are placed inside your website are ignored by the server for security reasons.

If you want to know what settings are in effect on your server, then create a php file containing the following code and browse to it using a web browser.

<?php phpinfo(); ?>

The page will return all of the PHP environment settings, and module information.


How did we do?


© Krystal Hosting Ltd 2003–2019