php.ini –configuration file for PHP

PHP.ini is the configuration file used to customize behavior of PHP runtime. This enables easy administration in the way you administer Apache web server using configuration files. Settings like default upload directory, register global variables, display errors, log errors and many more are available in this file for editing.

When PHP engine starts up it looks for PHP.ini file to load various values for settings defined as directives in memory. It looks for PHP.ini file in various locations in particular order.first of all it looks in current working directory or directory from which script was called then in root of web directory.finally Default php.ini file of web server.the copy of this ini file can be found in /usr/local/lib/php/ for UNIX installation.

 If you are using PHP with Apache then any changes made in PHP.ini file will be reflected only after restart of Apache server.

To apply custom configuration you can write your own php.ini file. First copy php.ini template 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 any particular folder if you want these settings to be effective for scripts residing in that folder only. 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.

About Author

Leave A Reply