phpinfo()function within a PHP script and viewing its output within the browser. The script is an easy one, consisting of just three lines:
<?php phpinfo(); ?>
phpinfo.phpfor instance), making sure it uses the typical
.phpextension. Call it within the browser and you'll be presented with a rather lengthy series of tabular output which begins in a fashion similar to that found in Figure 1. If this is new territory for you, I suggest spending some time perusing this output in order to familiarize yourself with the various ways in which PHP can be configured.
.htaccessfile and adding the following contents (in the following example, you'll need to replace the placeholder
123.456.789.000IP address with your own):
<Files phpinfo.php> Order Deny,Allow Deny from all Allow from 123.456.789.000 </Files>
phpinfo()function's output, several approaches are possible, beginning with the
php.inifile is PHP's primary configuration file, containing the vast majority of its configuration directives. Exactly when this file is read by PHP depends upon how PHP is installed. If installed as a server module (the most common approach), it is read only when the web server is started. If PHP's CGI version is installed (or you are using PHP's CLI version), then it will be read each and every time the PHP engine is invoked. Although this file can reside in a great many locations, you'll almost certainly find it within PHP's installation directory. You can easily determine its location by loading the aforementioned
phpinfo()script and reviewing the path associated with the
Loaded Configuration Filesetting.
php.inifile is presented below. Each configuration directive is assigned using a
directive_name = valuesyntax. For instance, the first directive,
engine, is set to
On, meaning the PHP engine is enabled. Semicolons are used to signify the start of a comment. You'll see that the developers have made copious use of comments in order to help new developers sort out the purpose of each directive.
[PHP] ;;;;;;;;;;;;;;;;;;;; ; Language Options ; ;;;;;;;;;;;;;;;;;;;; ; Enable the PHP scripting language engine under Apache. engine = On ... ; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized. ; NOTE: Using short tags should be avoided when developing applications or ; libraries that are meant for redistribution, or deployment on PHP ; servers which are not under your control, because short tags may not ; be supported on the target server. For portable, redistributable code, ; be sure not to use short tags. short_open_tag = On