You might need to change the PHP configuration for multiple reasons. Now you can modify your PHP configuration easily with cPanel’s MultiPHP INI Editor. A visual option to change the common PHP settings and changing from a text version is also available.
How to change PHP configuration in cPanel
- Log in to your cPanel account
- Click on the “MultiPHP INI Editor” icon from the Software section
- Now you have the “Basic Mode” and “Edit Mode” for editing your PHP configuration. “Edit Mode” will allow you to edit the php.ini in text mode.
- From the Configure PHP INI basic dropdown menu, you can select the entire home directory or any specific domain that you want to work with.
- Now you can modify the PHP settings such as memory_limit, max_execution_time, upload_max_filesize etc.
- After you have changed the values, click on the “Apply” button to save the changes.
display_errors: Enable this if you want to display the error messages to the end-user. By default, it is disabled.
max_execution_time: With this, you can set how much time a script can run before it is terminated. The time is set in seconds.
max_input_time: Set this time to limit the amount of time a script can parse input data like POST, GET and file uploads.
max_input_vars: You can limit how much input variables are allowed per request to prevent DDoS attack.
memory_limit: With this field, you can limit how much memory a script can use. This limitation makes sure that poorly written scripts do not eat up all the available memory of a server. It should be larger than post_max_size
post_max_size: This sets a maximum amount of post data allowed. It also affects file uploading so it should be larger than upload_max_filesize.
session.gc_maxlifetime: The maximum amount of time while the session data can live and after that, it will be gotten rid of as “garbage”
upload_max_filesize: The maximum size of a file allowed for upload on the website.
zlib.output_compression: This option compresses the webpages when the server receives “Accept-Encoding: gzip” or “deflate” header command.
You can change those values to set them according to your needs.
If you have selected the “Editor Mode”, you can also select the domain that you want to work with and enter the appropriate PHP configuration there.
It this few easy steps, you have successfully modified the PHP version of your website as you need.
How do I check PHP version and configuration?
You can check your PHP versions in a few ways, here, we will show you how you can check your PHP version and configurations with PHP configuration files. Where’s how to do that:
- Log in to your cPanel account, then go to File Manager.
- Open public_html folder and click on +File button at the top. Create the new file with filename phpinfo.php and click on “Create New File”
- Right-click on the newly created file and click on Edit button.
- If you are shown Encoding Check, then click on the “Edit” button. You can also click on “Disable Encoding Check” to disable this message in future edits.
- Paste the following code in the file:
<?php phpinfo(); ?>
- Click on save changes to save the file changes on the server.
- Now you can visit your website url/phpinfo.php and you will see the PHP configuration
On this page, you will find detailed information about PHP on your site. You can check which PHP version you are using and what extensions are enabled for your website. Once you are done with checking the configuration, remove the config file so that no one else can know your server status.
How can I change the PHP version of my website?
Changing with MultiPHP Manager
You can change PHP version for your websites from cPanel. To do that, follow the steps below:
- Log in to cPanel account.
- Go to MultiPHP Manager from the software section.
- Select the domains that you want to change the PHP version of by ticking the checkbox.
- Select your PHP version from the left-hand side dropdown menu.
- Click the apply button to save the changes.
You can change PHP versions for your individual domains and subdomains in this way.
Changing PHP version Using Cloudlinux “Select PHP Version” or “PHP Selector” from cPanel
You can also change the PHP version for your websites using the “Select PHP Version” from cPanel. The benefit of using the “Select PHP Version” option over the “Multiphp Manager” is that here you can also select which PHP extensions you want to enable or disable for your websites. You can easily enable or disable PHP extensions from the “Extensions” tab inside “Select PHP Version”. But the disadvantage is that you can not select an individual PHP version for all of your domain or subdomains using the “Select PHP Version” option. The PHP version that you select here will apply to all the websites that you have selected to use with this tool. Here is how to set it:
- After logging into the cPanel, go to the “Select PHP version”
- Select the PHP version that you want to set for your websites.
- On the bottom of the page, you will see a list of your domains and subdomains in that cPanel. If those domains or subdomains are not already using “PHP Selector”, then click on the “Use PHP Selector” button beside the domain or subdomain name.
That’s it! Your website is now using the PHP version that you have selected using the PHP Selector or “Select PHP Version” option.
Please keep in mind that, if your website PHP version has been defined by “Multiphp Manager” and it is using a default PHP version (Displayed on Step 4 of using MultiPHP manager), then you will not be set it to use “PHP Selector”. In that case, you will need to change the PHP version from MultiPHP Manager to some other version then the “System PHP Version” and after that, you can use that domain with “PHP Selector”.