IMPORTANT - Many PHP variables can now be configured in your cPanel control panel on the 'Select PHP Version' page under the 'Options' tab, without the need to create a php.ini file. Please contact our support team if you still require a php.ini file and read this article for more information: Manage PHP version and configuration for your cPanel hosting account
Follow these steps to create or modify a php.ini file:
Step 1 - Open up a text editor (such as Notepad or cPanel's File Manager) and add in the lines you need and save the file named as php.txt
.
Step 2 - Using the cPanel's File Manager or your FTP client you will need to upload the php.txt
file to the location you need it. This is usually inside of your public_html
folder.
Step 3 - Rename the php.txt
file to php.ini
, and save.
Step 4 - To protect the php.ini
file, you can add these lines to your .htaccess
file:
-
<Files .php.ini>
order allow,deny
deny from all
</Files>
This way, it cannot be displayed when somebody types in the file path into their browser.
Step 5 - Also, in the .htaccess file, you will need to add the following line:
-
suPHP_ConfigPath /home/username/public_html
Replace username with your actual cPanel username. This will tell your account where your php.ini file exists.
This list includes the php.ini directives you can set to configure your PHP setup:
Please note: Adjusting the memory limit on the shared hosting plans is not suggested. Since you are on a shared hosting platform, your memory limits are pre-determined by the server you are hosting on, and trying to use more memory than you have assigned to you will cause severe issues in the future which may be detrimental to your site.
Updated by SP on 14/12/2022