Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Understanding php.ini

13,997 views

Published on

understanding php.ini basic settings.

Published in: Technology

Understanding php.ini

  1. 1. Understanding php.ini Exploring the PHP configuration file.
  2. 2. What is php.ini <ul><li>It is a configuration file and control some of the setting of the PHP interpreter. </li></ul><ul><li>The configuration file (php.ini) is read when PHP starts. </li></ul><ul><li>Where a configuration setting may be set OR in how many ways you can set your configuration parameters. </li></ul><ul><li>Following modes determine when and where a PHP directive may or may not be set . </li></ul><ul><li>Mode Meaning </li></ul><ul><li>PHP_INI_USER Entry can be set in user scripts using function like ini_set(). </li></ul><ul><li>PHP_INI_PERDIR Entry can be set in php.ini, .htaccess or httpd.conf </li></ul><ul><li>PHP_INI_SYSTEM Entry can be set in php.ini or httpd.confPHP_INI_ALLEntry can be set anywhere </li></ul><ul><li>In this presentation all the php.ini setting can be set in user’s script. </li></ul>
  3. 3. Basic Important Settings <ul><li>Language Options </li></ul><ul><li>Resource Limit </li></ul><ul><li>Data Handling </li></ul><ul><li>File Uploads </li></ul><ul><li>Others </li></ul>
  4. 4. Language Options <ul><li>short_open_tag : Tell whether to use short 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”. </li></ul><ul><ul><li>Description : <? echo “Hello reader” ?> is short-form PHP tags </li></ul></ul><ul><ul><li><?php echo “Hello Reader” ?> is long form PHP tags </li></ul></ul><ul><li>asp_tags : Enable the use of ASP-like <% %> tags in addition to <?php ?> tags. </li></ul><ul><li>Description : This tag setting is kept to make easiness for developers who started with PHP after ASP. </li></ul>
  5. 5. Resource Limit <ul><li>memory_limit : Maximum amount of memory a script may consume. Default value is 128 MB. </li></ul><ul><li>max_execution_time : Maximum execution time of each script, in seconds. Default value is set to 30 sec. </li></ul>
  6. 6. Data Handling <ul><li>register_globals : Whether or not to register the EGPCS variables as global variables. By default it is set to “Off”. </li></ul><ul><li>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. </li></ul><ul><li>PHP code when register_globals = On </li></ul><ul><li> $myName = $name; </li></ul><ul><li>PHP code when register_globals = Off </li></ul><ul><li> $myName = $_POST[‘name']; </li></ul><ul><li>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. </li></ul>
  7. 7. File Uploads <ul><li>file_uploads : Whether or not to allow HTTP file uploads.Default value is “On”. </li></ul><ul><li>upload_tmp_dir : The temporary directory used for storing files when doing file upload. Will use system default if not specified. By default it is empty. </li></ul><ul><li>upload_max_filesize :The maximum size of an uploaded file. Default value is 2M. </li></ul>
  8. 8. Others <ul><li>allow_url_fopen : Whether to allow the treatment of URLs (like http:// or ftp://) as files. Default value is “ON”. </li></ul><ul><li>Description: </li></ul><ul><li>if allow_url_fopen =Off </li></ul><ul><li>file_get_content( http://www.sitename.com/test.txt ) will not work !! </li></ul><ul><li>session.cache_expire : Document expires after n minutes. Default value is 180. </li></ul><ul><li>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. </li></ul><ul><li>session.save_handler : Handler used to store/retrieve session data. Default value is files </li></ul>
  9. 9. Contact Me All Questions, comments and feedbacks are welcomed at pritiatwork@gmail.com.

×