PHP.ini file

Nov 14, 2013, by admin

PHP.ini is a configuration file that is used to customize behavior of PHP at runtime.
This enables you to easy administration in Apache web server using configuration files.The settings in which upload directory, register global variables, display errors, log errors, max uploading size setting, maximum time to execute a script, libraries available and other configurations is written in this file.You can update it according to your needs.
When PHP Server starts up it looks for PHP.ini file first to load various values for settings.If you made changes in PHP.ini then you need to restart your server to check the changes be effected.
Where is my PHP.ini file?
It depends where php is installed.
The path where PHP looks for its PHP.ini file is built into PHP on compile time.To find out that path, use a PHP script/function that does a phpinfo() call.This will display a huge table of all of PHP’s configuration variables, libraries and extensions available.The path to PHP.ini can be found in the first part of that table.
In xampp it is available on path like
D:xamppphppnp.ini
If you want to do some custom configurations then you can also write your own PHP.ini file.For this just copy PHP.ini file, make necessary changes in values directives according to your need rename it to PHP.ini then copy it to desired location in root of your web directory or in particular folder.But hosting should allow for running this file.The PHP runtime will take values only for settings which are specified in PHP.ini file if you are using your own, for rest of settings it will take defaults of PHP runtime.So if you are writing your own PHP.ini, keep in mind to overwrite every settings specified in web server’s PHP.ini file this can not be used as an extension of web server’s PHP.ini file.
Instead of creating new file, you can also update the configuration settings written in PHP.ini as well.
If you want some special configuration(PHP) on a single page,there are some functions available start with ini_ as follows.
ini_set()
ini_get_all()
ini_get()
ini_restore() etc.