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.

DISCLAIMER: The scripts provided in our knowledgebase are for informational purposes only. We do not provide any warranty or support. It is essential to review and modify the scripts to fit your site's specific needs. There may be unforeseen outcomes when adding new script code to an existing website. You should discuss it with your website manager and seek advice from an experienced website developer if you are unsure.

Updated by SP on 14/12/2022

Was this answer helpful? 360 Users Found This Useful (787 Votes)