Knowledge Base
MilesWeb / How-Tos

How to control PHP settings with a custom php.ini file

Approx. read time : 3 min

The article explains how you can use custom php.ini files. This will help to control PHP settings for your web site.

#Steps to set up a custom PHP.INI file :

A php.ini file contains directives to control many PHP settings. You may set up one or multiple custom php.ini files to define the working of your website functions. For example, you can have a custom file in your /home/username/public_html directory for your website’s main pages, and also an isolated custom file in your /home/username/public_html/images directory for your website’s image files.

Perform the following steps to set up a custom php.ini file :

1. Log in to your cPanel account.

2. Use the File Manager and navigate to the directory where you want to modify the behavior of php. By default, a custom php.ini can have its effects only on the directory where it is located.

3. Click on the File button in the File Manager toolbar to create a new file and name it php.ini.

4. Click on the new file. After that click on the Edit button in the File Manager toolbar to edit the new php.ini.

5. Also, add php directives to the new php.ini and then click on the Save Changes button.

6. Once you have created the php.ini file and have set its permissions, then you can verify that the configuration is active. To do this, create a phpinfo file in the directory where you have created the php.ini.

7. Load the phpinfo file in your web browser, identify one of the directives you have set. Assure that the changes made are visible.

8. You can also create a custom php.ini files for each directory in your website. But, yet many people configure the settings in one php.ini file and then apply it to the entire website. To do so, add the following line to the .htaccess file in your web site’s document root directory.

Remember to replace username with MilesWeb Hosting username :

lsapi_phpini /home/username/public_html/php.ini

Get more information about the complete list of php.ini directives at :

Also Read :

1) Steps to Create a PHP Redirect

2) A Complete Guide To Using phpMyAdmin

3) Setting Your PHP Settings in Command Line

With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.
Need help? We’re always here for you.