Understanding of php.ini

Written by Anuj kumar

It is configuration file an d control some of the setting 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 :

Mode Meaning
PHP_INI_USER Entry can be set in user script using 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
  • Others

Language Options

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.

Resource limit

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.

Data Handling

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

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”.


if allow_url_fopen=Off

file_get_content( 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. Default value is 1440.

session.save_handler: Handler used to store/retrieve session data. Default value is file.

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.