When you are working on a website, a php.ini file can be used for a lot of neat things. More times than not, it is used to increase your upload limit. Are you in the need for a php.ini file, but your web hosting account is lacking one? You can create your own and upload it to the right spot after following a few simple steps.
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.
Step 2– Using the cPanel’s File Manager or your FTP client you will need to upload the file to the location you need it. This is usually inside of your public_html folder.
Step 3– Rename the file to php.ini, and save. To protect the php.ini file, you can add these lines to your .htaccess file:
- <Files php.ini>
- order allow,deny
- deny from all
This way, it can not be displayed when somebody types in the file path into their browser.
Step 4– 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 user name. 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:
Friendly Reminder: 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 you issues in the future.