00001 <?php
00013 function show_php_net_page()
00014 {
00015 ?>
00016 <html>
00017 <head>
00018 <title>php.net configuration file</title>
00019 <style type="text/css">
00020 p {text-align:justify}
00021 </style>
00022 </head>
00023 <body>
00024 <h3>php.net configuration file</h3>
00025 <p>
00026 Location of php.net file can be found using phpinfo() function.
00027 It is important to verify that we are modifying correct php.net
00028 file as there can be multiple php.net files due to improper
00029 installations or due to multiple parallel versions of PHP etc.
00030 </p>
00031
00032
00033 <p>
00034 Following variables are of considerable interest:
00035 </p>
00036 <dl>
00037 <dt>short_open_tag</dt>
00038 <dd>
00039 Historically PHP start tag was <? instead of <?php. But it
00040 was soon realized that <? starting tag would cause confusion /
00041 problems and hence <?php was introduced as new PHP start tag.
00042 But since there is enough legacy code already present, the new
00043 PHP engines support both <? and <?php tags for starting PHP.
00044 Using this option we can stop support for old start tag (<?).
00045 If you are not going to use any old code then it can be set to Off
00046 </dd>
00047
00048
00049 <dt>output_buffering</dt>
00050 <dd>
00051 This parameter had to be introduced to resolve too many problems which
00052 novice programmers where facing while using header() function. It is
00053 important to understand why this was required and what it does.
00054 (Details will be explained in class).
00055 </dd>
00056
00057
00058 <dt>zlib.output_compression</dt>
00059 <dd>
00060 This option saves considerable bandwidth but is security nightmare. It is
00061 important to understand why. (Details will be explained in class).
00062 </dd>
00063
00064
00065 <dt>max_execution_time</dt>
00066 <dd>
00067 Maximum execution time of each script, in seconds. Increase to at least 150
00068 if you are going to use PHP from command line very often or if you do complex
00069 calculations / long database manipulations using PHP. You can also optionally
00070 use a differnet php.ini file when using PHP from command line using
00071 '<tt>--php-ini</tt>' option.
00072 </dd>
00073
00074
00075 <dt>max_input_time</dt>
00076 <dd>
00077 Maximum amount of time each script may spend parsing request data. Again this
00078 can be made equal to max_execution_time when using command line.
00079 </dd>
00080
00081
00082 <dt>memory_limit</dt>
00083 <dd>
00084 Maximum amount of memory a script may consume. Increase it with caution. If you
00085 face memory errors too often and you have enough free RAM and less number of
00086 parallel users then this can be increased.
00087 </dd>
00088
00089
00090 <dt>error_reporting</dt>
00091 <dd>
00092 This is used to set what type of errors to report. Once can use E_ALL in most
00093 setups.
00094 </dd>
00095
00096
00097 <dt>display_errors</dt>
00098 <dd>
00099 <span style="font-weight:bold">Should be 'On' during development, should be 'Off' during
00100 production</span>. This whole php.net configuration file page is created just to explain
00101 proper configuration for this parameter.
00102 </dd>
00103
00104
00105 <dt>display_startup_errors</dt>
00106 <dd>
00107 Can be left On during development. Carefully choose based on application / scenario whether
00108 to be left On or Off during production.
00109 </dd>
00110
00111
00112 <dt>log_errors</dt>
00113 <dd>
00114 If display_errors is Off then this must be set to On, else debugging would be nightmare.
00115 </dd>
00116
00117
00118 <dt>variables_order</dt>
00119 <dd>
00120 Interesting to know. (Details explained in class)
00121 </dd>
00122
00123
00124 <dt>register_globals</dt>
00125 <dd>
00126 Never turn this On. Habit of using this feature is
00127 <span style="font-weight:bold">extremely</span> bad idea.
00128 (Details explained in class)
00129 </dd>
00130
00131 <dt>post_max_size</dt>
00132 <dd>
00133 This must be increased if your PHP page is going to handle upload
00134 of bigger files. For servers that are going to handle file uploads
00135 of files about 50MB in size this can be set to 64MB or so.
00136 </dd>
00137
00138 <dt>upload_max_filesize</dt>
00139 <dd>
00140 Maximum allowed size for uploaded files. Set to 50MB if you want to
00141 handle file uploads of up to 50MB in size.
00142 </dd>
00143 </dl>
00144
00145 <p>
00146 Students are encouraged to look at other parameters defined in php.net file
00147 and read about them. The case of sessions and how they work should be
00148 interesting.
00149 </p>
00150 </body>
00151 </html>
00152 <?php
00153 }
00154
00155 show_php_net_page();
00156
00157 ?>