Understanding of php.ini

2676 0

$1*/ mo hosting! Get going with GoDaddy!


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

$myName=$name;

PHP code when register_globals=Off

$myName=$_POST[‘name’];

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.

Others

allow_url_fopen: Whether to allow the treatment of URLs(like http:// or ftp://) as files. Default value is “ON”.

Description

if allow_url_fopen=Off

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

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

In this article

Join the Conversation



Share