Understanding of php.ini

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 “” not found /]

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. The default value is 1440.

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

Anuj Kumar

This is Anuj Kumar. I’m a professional 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 provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials.

Recommended Tutorials for you

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.