Overview
If your website requires specific PHP settings, you can adjust PHP variables such as memory_limit, upload_max_filesize, and max_execution_time using CloudLinux's PHP Selector in cPanel. This guide will walk you through the process.
Prerequisites
-
Access to cPanel.
Steps to Modify PHP Variables
1. Log in to cPanel
-
Navigate to your cPanel account. Usually, this can be accessed via
yourdomain.com/cpanelor through the client area. -
Enter your cPanel credentials and log in.
2. Open the Select PHP Version Tool
-
Scroll down to the Software section.
-
Click on Select PHP Version.
3. Change PHP Version (If Needed)
-
On the PHP Selector page, you will see your current PHP version.
-
If needed, select a different PHP version from the drop-down menu.
-
Click Set as current to apply the change.
4. Adjust PHP Variables
-
Click on the Options tab.
-
You will see a list of PHP variables available for modification.
-
Locate the setting you want to modify (e.g.,
memory_limit,upload_max_filesize,max_execution_time). -
Click on the value and enter the desired number or select from the dropdown options.
5. Common PHP Variables and Recommended Values
| PHP Variable | Default Value | Recommended Value (Depends on Needs) |
|---|---|---|
memory_limit |
128M | 256M or higher for CMS websites |
upload_max_filesize |
2M | 32M or higher for large uploads |
post_max_size |
8M | 32M or higher (must be >= upload_max_filesize) |
max_execution_time |
30 | 60 or higher for large scripts |
max_input_vars |
1000 | 3000 or higher for complex forms |
6. Save and Apply Changes
Changes are automatically saved in the PHP Selector. No additional action is needed.
7. Verify the Changes
To confirm that your new PHP values are active:
-
Create a
phpinfo.phpfile in your website’s public directory. -
Add the following code to it:
<?php phpinfo(); ?> -
Save the file and open it in a browser (e.g.,
yourdomain.com/phpinfo.php). -
Look for the updated PHP values.
-
Once verified, delete the file for security reasons.
