What Is a php.ini File? As all, we know PHP is an open-source scripting language which means we can modify PHP configuration according to our use. So, the php.ini is the main configuration file of PHP that we used to modify the execution time, upload file size, and much more.
PHP INI file is created at the time of PHP installation. If you install XAMPP there is also an auto-generated PHP INI configuration that we use to set up the maximum upload size for our PHPMYADMIN database.
Use of PHP INI File
Here is a list of major use of the PHP INI configuration file.
- By using the INI configuration file we can increase PHPMyAdmin DB Import Size.
- We can maximize the execution time of PHP files or prevent timeout issues (max_execution_time).
- It is used to disable error reporting like PHP error notices and warnings (error_reporting).
- Also, we can enable and disable file upload functionality by using PHP INI configuration (file_uploads).
- Set memory limit for PHP scripts which allows the script to take defined memory (memory_limit).
Example of PHP.INI File
In this example, I will show you how you can increase your upload size limit,
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
post_max_size = 750M
upload_max_filesize = 750M
Please note that after you do these changes you have to restart your servers.
php.ini File Location In XAMPP
Go to your installation directory then find the folder named xampp. Now check the path which I show you above.
How to Create php.ini File
You can also create a PHP.INI file in your project root directory to override the setting of the default configuration.
To create a php.ini file, you just create a file name with php.ini and set your configuration as suggested in the above example. And then save it.
php.ini File Location in cPanel
- Open your cPanel and search of MultiPHP INI Editor.
- You get the same, now click on it and select the version of PHP from the dropdown.
- You get your configuration page where you can modify the values according to your use.
Here is the complete guide for the PHP INI configuration file and its use with examples.
Please let the comment below if you get any issues.
To know more about PHP configuration you can check here https://www.php.net/manual/en/configuration.file.php.
- Load Dynamic Content in Bootstrap Modal using Ajax