How to Find and Edit php.ini in cPanel


The php.ini file controls PHP configuration settings such as memory limits, file upload sizes, execution time, and error reporting. Customizing these settings allows you to optimize PHP for your specific web application.

Method 1: Edit via MultiPHP INI Editor (Recommended)

  1. Login to cPanel.
  2. Under Software, click MultiPHP INI Editor.
  3. Select your domain from the dropdown.
  4. You can use Basic Mode to adjust common settings with sliders/checkboxes, or Editor Mode to directly edit raw php.ini directives.
  5. Click Apply to save.

Common php.ini Settings to Customize

; Maximum memory a script can use
memory_limit = 256M

; Maximum file upload size
upload_max_filesize = 64M

; Maximum size for POST data
post_max_size = 64M

; Maximum time a script can run (seconds)
max_execution_time = 300

; Maximum time for input parsing
max_input_time = 300

; Display errors (disable on production)
display_errors = Off

; Log errors to file
log_errors = On

Method 2: Create a Custom php.ini in public_html

You can place a custom php.ini file directly in your public_html folder:

  1. Go to cPanel → File Manager → public_html.
  2. Click + File and name it php.ini.
  3. Right-click and select Edit.
  4. Add your custom PHP directives and save.

Note: Changes via MultiPHP INI Editor take effect immediately without needing to restart the server. Always test your site after making php.ini changes.

Checking Current PHP Settings

To verify your current PHP settings are applied, create a test file:

<?php phpinfo(); ?>

Save it as info.php in public_html and visit yourdomain.com/info.php. Delete the file after checking — never leave it on a live site.

If you continue to face issues, please open a create a request.

Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)