While installing PHP, this file is provided with PHP installation settings. For that, it includes 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 error, while running our PHP project in this host.
[PATH="/home/user/.."] display_errors = on
This file is located inside PHP folder of the location where we have installed PHP. If we use 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 version that should be renamed as php.ini. For example, if those versions are named as php.ini_dist and php.ini_recommended, then we need to select the later 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 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 than 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 own PHP.ini file we can configure our PHP environment on a need basis.