How to Enable and Increase PHP Variables in cPanel

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

  1. Navigate to your cPanel account. Usually, this can be accessed via yourdomain.com/cpanel or through the client area.

  2. Enter your cPanel credentials and log in.

2. Open the Select PHP Version Tool

  1. Scroll down to the Software section.

  2. Click on Select PHP Version.

3. Change PHP Version (If Needed)

  1. On the PHP Selector page, you will see your current PHP version.

  2. If needed, select a different PHP version from the drop-down menu.

  3. Click Set as current to apply the change.

4. Adjust PHP Variables

  1. Click on the Options tab.

  2. You will see a list of PHP variables available for modification.

  3. Locate the setting you want to modify (e.g., memory_limit, upload_max_filesize, max_execution_time).

  4. 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:

  1. Create a phpinfo.php file in your website’s public directory.

  2. Add the following code to it:

    <?php phpinfo(); ?>
  3. Save the file and open it in a browser (e.g., yourdomain.com/phpinfo.php).

  4. Look for the updated PHP values.

  5. Once verified, delete the file for security reasons.

  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

How to Add & Manage DNS Records in cPanel

Using AutoSSL with Cloudflare If your website uses Cloudflare alongside cPanel AutoSSL, certain...

Using AutoSSL with Cloudflare

If your website uses Cloudflare together with cPanel AutoSSL, you may occasionally experience SSL...