The php.ini file is a file that can be created to customize some of the configurations for your particular hosting account’s PHP setup. Some of the things you may be able to edit would be whether global variables are turned on or off, maximum allowed size for uploaded files, and more.
Your first step would be to open up a text editor (such as Notepad or cPanel’s File Manager) and add in the lines you need and save the file. Next, 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.
This link includes the php.ini directives you can set to configure your PHP setup.
Now, 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
- </Files>
This way, it can not be displayed when somebody types in the file path into their browser. With some web hosts, 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. Other web hosts might have other rules when it comes to setting up the php.ini file for their hosting environment, so you might check with them to see what they recommend.









