How to Modify PHP Parameters in cPanel

Overview

The php.ini file controls various PHP settings that can influence how your website functions. These settings include memory limits, execution time, file upload limits, and more. You can easily edit these settings using the MultiPHP INI Editor in cPanel, or by manually creating a php.ini file.

Method 1: Using MultiPHP INI Editor (Recommended)

  1. Log in to cPanel.
  2. Access the MultiPHP INI Editor from the Software section.
  3. Select the domain you want to modify from the dropdown menu.
  4. Modify any PHP parameters (as demonstrated in the screenshot below) and click Apply to save your changes.

Method 2: Manually Editing or Creating a php.ini File

If you need to manually create or modify the php.ini file for your domain, follow these steps:

  1. Log in to cPanel.
  2. Navigate to the Domains section and click the Document Root for your domain.
  3. If a php.ini file already exists, you can Edit it. If not, create one by clicking + File and naming it php.ini.
  4. Add or modify the PHP parameters you need and then click Save Changes from the top-right corner.

Common PHP Parameters You May Need to Modify

  1. memory_limit: Adjust this value if you need to allocate more memory to PHP scripts (useful for resource-intensive applications like WordPress).
    Example: memory_limit = 256M
  2. max_execution_time: Increase this value if scripts on your site need more time to execute.
    Example: max_execution_time = 300
  3. upload_max_filesize: Set the maximum file size for uploads. 
    Example: upload_max_filesize = 64M
  4. post_max_size: This should be at least as large as upload_max_filesize, as it governs the maximum size of POST data.
    Example: post_max_size = 64M
  5. max_input_vars: If you're working with large forms, you might need to increase this to allow for more input fields. 
    Example: max_input_vars = 2000
  6. display_errors: Toggle this to show or hide PHP error messages on your site.
    Example: display_errors = On (or Off for live websites)

Use Cases for Modifying PHP Parameters

  1. Increasing Script Memory
    Useful for applications like WordPress, Joomla, or Magento that may require more memory.
  2. Extending Execution Time
    Beneficial for running long tasks such as backups or complex database operations.
  3. Handling Large File Uploads
    Adjusting upload limits can help manage large files like media or databases.
  4. Managing Input Fields for Large Forms
    Increase max_input_vars to handle larger forms without errors.
  5. Improving Error Debugging
    Turning on display_errors can help developers troubleshoot issues on a staging or development site.

Conclusion

By modifying these parameters in the php.ini file, you can optimize your website’s performance based on your specific needs. Whether you need more memory, longer execution times, or larger file upload limits, these changes can be made quickly using cPanel’s MultiPHP INI Editor or by manually editing the php.ini file.

Was this answer helpful?