PHP provides us so many facilities, php.ini file is one of them, with the help of it we can customize the behavior of php. Using this file maintaining PHP will be as easy as maintaining Apache. The php.ini file is used after implementation and using it you can configure all PHP's runtime configurations. It is also better in the sense that we do not need to recompile PHP again and again.
When PHP starts up its engine, one of the first thing it looks up for the php.ini in the current working directory, whenever we compile PHP, most of the time a copy of ini file places a copy of itself in /usr/local/lib/php.
To find out the ini file in Unix system you need to type "locate php.ini " or "find / -name php.ini -print". On the other hand in Windoows you can use the simple search option from start menu.
php.ini file allows to customize PHP dynamically but at the same time if it is running as an Apache module configuration directives reside in memory until a new Apache process has been started. The configuration information is read again and again PHP as CGI program whenever the CGI program starts a new process and this is the reason PHP considers as dynamic, otherwise until the web server starts PHP configuration remains unchanged
In the earlier versions of PHP, you could admit the configuration directives as Apache directives in either httpd.conf or .htaccess files. From PHP version 4.x onwards it became necessary to keep all directives in php.ini file.
It should be keep in mind that if we use PHP as CGI then we must keep the "safe mode" as ON, and after that set safe_mode_exec_dir directive. By doing this you can be assure that user can access only those information which are documented as root.
The structure of php.ini file is very much similar to Windows .ini files, it is based on standard "directive = value" syntax. Semicolon is used to make comments, so lines start with semicolon are ignored. To put an empty value to a directive use value blank or use keyword none. Sections are defined within [ and ] brackets.
Recommend the tutorial