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.
Changes to any of these settings – PHP version, modules/extensions & options – take effect virtually instantly. See the section below on Checking your current PHP settings.
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 – external link opens in a new window 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 – external link opens in a new window listed including DOM, and soap, which may not be enabled by default.
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 7.3 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.
This functionality should be used with care. Selecting incompatible extensions can cause intermittent or permanent errors or performance degradation – for example, the apc extension should not be used with PHP 5.4 and above.
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. Changes you make will be saved automatically.
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. Be careful to ensure you don’t leave any spaces and that there are single commas between each remaining function. Clicking 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.
Any php.ini files that are placed inside your website are ignored by the server for security reasons.
Checking your current PHP settings
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.
The page will return all of the PHP environment settings, and module information.
e.g. use File Manager to create a new file called phpinfo.php inside your public_html directory – then edit that file and copy/paste in the code above and save the file. You can now view this file at https://<your-domain>/phpinfo.php – replacing <yourdomain> with your primary domain served from public_html.
Diffusion Hosting has one goal, to provide reliable, feature packed website hosting at a reasonable cost that everyone could use!
Diffusion HostingKemp House152 – 160 City RoadLondonEC1V 2NX
Website HostingNode.js HostingPython HostingRuby Hosting
Charity HostingWebsite BuilderBlog Hosting
My AccountKnowledge BaseStatus PageUptime PageContact Support