While installing PHP, this file is provided with PHP installation settings. For that, it includes a set of directives provided with respective values. These directives are of two types based on the values they have. These are,
This file has two sections based on which the value and flag directives can be set with. These sections are,
[HOST="www.somedomain.com"] display_errors = off
This setting will not allow displaying errors while running our PHP project on this host.
[PATH="/home/user/.."] display_errors = on
This file is located inside the PHP folder of the location where we have installed PHP. If we use the XAMPP package, we could find this file in \xampp\php.
After installing PHP, we can find one or more versions of a php.ini file. We need to choose any one of the preferable versions that should be renamed php.ini.
For example, if those versions are named php.ini_dist and php.ini_recommended, then we need to select the latter one. Because, it is an optimized file with respect to performance, security and etc. So, we need to rename php_ini_recommended as php.ini
If we use the XAMPP package to install PHP on our local machine, then there will be another set of two versions of this file, that is, php.ini-development and php.ini-production. Among them, php.ini-development is preferable to the other to rename as php.ini.
We can make changes to this file on-demand basis. For example, if we want to access the remote file, we need to set the option allow_url_fopen to be enabled.
After making any change with either php.ini, we need to restart our XAMPP server (or any package using which the PHP is installed) to make these changes to be effective in our PHP environment.
This file includes settings related to the PHP environment features like error handling, remote access, file uploads, configuring image-related settings, for example setting the maximum size of images to upload and etc.
This file also has directives to configure with session and cookie-related settings. But, some of the php.ini directives are deprecated as of later versions of PHP.
We can also customize php.ini file as our own by following the default template of this file provided while installing PHP. By customizing our own PHP.ini file we can configure our PHP environment on a need basis.