How to edit php.ini on Shared servers

This guide describes how to edit the php.ini file on shared servers.

1. Log into your cPanel account, go to the Files section >> the File Manager menu.

For cPanel Basic Theme:
 

 
For cPanel Retro Theme:
 

 
2. Navigate to the root directory of the domain, click on New File, and create a file named php.ini:
 

 
3. Find the newly created file in the list, right-click, and choose Edit:
 

 
4. Add the required PHP settings and click on Save Changes in the top right corner:
 

 
When all updates are completed, make sure to add lsapi_phpini directive.

If you wish to change values for the PHP settings (e.g., max_execution_timememory_limitpost_max_sizeupload_max_filesize, etc.), you must reset the values in the Select PHP version menu. This way, it will be possible to overwrite PHP settings using php.ini.
 
NOTE: max_execution_time can be increased up to 300 seconds.

1. Log into your cPanel account >> Select PHP version menu.

 
2. Go to the Switch to PHP Options menu:
 

 
3. Reset the option in question:
 

 
4. You may then apply changes to the required value in the php.ini file:
 
 
 

How to upload and edit an existing php.ini file

 
1. Log into your cPanel account, go to the Files section >> the File Manager menu.

For cPanel Basic Theme:
 

 
For cPanel Retro Theme:
 

 
2. Navigate to the root directory of the domain name in question, upload the php.ini file that corresponds to your current PHP version. Feel free to download php.ini for different PHP versions below in the Attachments section at the end of the guide.

3. Once done, use the Extract option:
 
 
4. After that, right-click on php.ini.txt to Rename it php.ini, then another right-click to use the Edit option:

 
5. Here, you can use the search option and find the needed limit or value. In this example, it is upload_max_filesize.

 

 
6. Once all the required changes are made, click Save.


In order for the php.ini to work, add lsapi_phpini directive.


That's it!
  • 60 Users Found This Useful
Was this answer helpful?

Related Articles

PHP modules and extensions on shared hosting servers

PHP is an open-source scripting language that is mainly used to create dynamic web pages. Its...

How to set PHP timezone in php.ini

You can configure PHP setting to use your local time zone by setting the date.timezone directive...

How to disable magic_quotes

You can modify different php settings for your account using a php.ini file. We recommend using...

How to enable exec()

You can modify different php settings for your account using a php.ini file. We recommend using...

How to enable register_globals

You can turn on register_globals in your php.ini file. To do this, please create a php.ini file...