PHP is an acronym for Hypertext Preprocessor. It is one of the most widely used scripting languages in web development. PHP is processed on the server and is usually embedded in HTML code.
Most common Content Management Systems (CMS) like WordPress run on this technology. PHP is extremely simple for new programmers and is usually offered alongside MySQL - a database management system.
PHP is installed by default on your hosting account unless you are on a VPS Plan (Virtual Private Server) and you can use it directly on your websites without any manual installation.
Sometimes, you may need to change the default PHP version or enable some modules or probably change the default options directly from cPanel and all these form the basis of this guide.
- A domain name e.g. www.example.com
- A web hosting account that supports cPanel and PHP
- cPanel username and password.
Step 1: Log to your cPanel Account
Append the text ‘/cpanel’ on your primary domain associated with your hosting account to access cPanel. For instance, if your domain is ‘www.example.com’, type ‘www.example.com/cpanel’ on your browser. Then, enter your username and password to proceed as shown below:
Step 2: Search for PHP version on the cPanel Dashboard
Once you are logged in, enter ‘php’ in the search text box and click the link ‘Select PHP version’ as shown below:
Step 3: Change the PHP version
You can now see the available PHP versions on the next screen as well as all associated PHP modules or extensions. You can click on the drop-down checkbox to switch to your preferred PHP version. For instance, if your software only works with a certain version, choose it from the list as shown below and click ‘Set as current’:
Step 4: Enable/disable PHP extensions
You can also select/deselect any PHP extension from the list by checking/un-checking the box on the right side of an extension name. For instance, to enable ‘mysqli ‘extension, check the box as shown below:
To save the changes, click the ‘Save’ button as shown above.
Step 5: Customize PHP options
On the same screen, locate the link ‘Switch To PHP Options’ at the top right and click it as shown below:
On the next screen, you can see different PHP options that you can customize as shown below:
In most cases, you will be tweaking the following options
display_errors: This value is ‘off’ by default, if you change it to ‘On’, errors on PHP scripts will be displayed on the browser.
max_execution_time: This value displays the maximum execution time a script should run. You may set the value to a higher limit if you want.
post_max_size: This value displays the max value that can be accepted by POST and GET variables. This is most common in web forms.
upload_max_size: You may tweak this value to adjust the maximum upload file size that should be supported on your website. For instance, if you are uploading a large MySQL database, you might need to adjust this value.
In this guide, we have shown you how to change the PHP version, enable/disable some extensions and customize different PHP options depending on your hosting needs. That is the best thing about cPanel because it makes customizing PHP extremely very easy. We hope you enjoyed this guide and it will assist you to fine-tune your PHP settings to suit your web hosting needs.