It is configuration file and controls some of the settings of the PHP interpreter.
The Configuration file(php.ini) is read when PHP starts.
Where a configuration setting may be set OR in how many ways you can set your configuration parameters.
Following modes determine when and where a PHP Directive may or may not be set :
[table caption=”” width=”700″ colwidth=”200|500″ colalign=”left|left]
PHP_INI_USER, Entry can be set in user script using a function like ini_set().
PHP_INI_PERDIR, Entry can be set in php.ini or .htaccess or httpd.conf.
PHP_INI_SYSTEM, Entry can be set in php.ini or httpd.conf. PHP_INI_ALL entry can be set anymore.
Basic Important Settings
- Language Options
- Resource limit
- Data Handling
- File Uploads
short_open_tag: Tell whether to use form(<? ?>). If you disabled then you must use the long form of the PHP tags i.e(<?php ?>).By default it is set to “1”.
Description: <? echo “Hello reader”?> is short-form PHP tags. <?php echo “Hello reader”?> is long form PHP tags.
asp_tags: Enable the use of ASP-like<% %> tags in addition to <?php ?> tags.
Description: This tag setting is kept to make easiness for developers who started with PHP after ASP.
memory_limit : maximum amount of memory a script may consume. Default value is 128 MB.
max_execution_time: Maximum execution time of each script, in seconds. Default value is set to 30 sec.
register_globals : Whether or not to register the ECPCS variables as global variables. By default is set to “off’.
Description: Consider a Form field<input name=”name” type=”text”>. When form is submitted via POST the form value for name will be fetched as show below :
PHP code when register_globals=On
PHP code when register_globals=Off
post_max_size : Maximum size of POST data that PHP will accept or you can POST through form. Default values is 8M. This setting is helpful for file uploads.
file_uploads: Whether or not to allow HTTP file uploads. Default value is “On”.
upload_tmp_dir : The temporary directory used for storing files when doing file upload. Will use system default of not specified. By default it is empty.
upload_max_filesize : The maximum size of an uploaded file. default value is 2M.
allow_url_fopen: Whether to allow the treatment of URLs(like http:// or ftp://) as files. Default value is “ON”.
file_get_content(http://www.sitename.com/test.txt) will not work.
session.cache_expire : document expires after n times. default value is 180.
session.gc_maxlifetime : After this number of seconds, stored data will be seen as ‘garbage’ and cleaned up by the garbage collection process. The default value is 1440.
session.save_handler: Handler used to store/retrieve session data. The default value is file.