SakhaliaNetHome PageHistory of the RailwayVorKutaAcceptance of cookiesAcceptance of cookies

PHP Tutorial :: Reference (III)

Reference of PHP

PHP configuration directives



Directive Recommended value Description
allow_url_fopen On Allows functions such as file_get_contents() to work with URLs besides local paths
auto_append_file Set it with a file name so that the PHP code written on that file will be executed after the PHP interpreter executes a program. This allows for example to print a footer in the pages.
auto_prepend_file Set it with a filename so that the PHP code written on that file will be executed before the PHP interpreter executes a program. This allows to include functions or files that are used everywhere in the website.
browscap Set it as the file name of a browser possibilities file.
display_errors On for debugging, Off for production When activated, the PHP interpreter prints errors as part of the result of PHP programs.
error_reporting E_ALL Controls which type of errors will be reported by the PHP interpreter.
extension Each extension line in php.ini loads a PHP extension. The extension library must be present in the system to load it.
extension_dir The directory in which the PHP interpreter looks for the extensions specified by the directive extension.
file_uploads On Controls if it is allowed to send files via forms.
include_path A list of directories in which the PHP interpreter looks for files that are loaded via include(), require(), include_once() and require_once().
log_errors On When activated, the PHP interpreter places the program errors in the server's error log file.
magic_quotes_gpc Off When activated, the PHP interpreter automatically escapes form input data to prepare it for being included in a SQL query. Not recommended because it unnecessarily adds slashes in any string that is not used for a SQL query.
magic_quotes_runtime Off When activated, the PHP interpreter automatically escapes data read from an external file to prepare it for being included in a SQL query. Not recommended because of forementioned reasons.
output_buffering On When activated, the PHP interpreter waits for its script to be executed before sending HTTP Request and Response Headers, facilitating the usage of cookies and sessions.
register_globals Off When activated, the PHP interpreter creates individual variables for each form sent or URL variable. For example, the global variable dinner would contain the value of the parameter "dinner" of the form sent. Activating register_globals exposes the programs to many security risks.
session.auto_start On (if sessions are used) When activated, the PHP interpreter starts a session at the beginning of each webpage, so calling the function session_start() would be unnecessary.
session.gc_maxlifetime 1440 The number of seconds that a session should last before expiring. The default value 1440 is good for most applications.
session.gc_probability 1 The possibility (in percentage) that the expired sessions would be cleaned at the beginning of any request to the server. The default value 1 is good for most applications.
SMTP This directive is used only in Windows. It is the name of a SMTP host that should be used for sending messages when calling the function mail().
short_open_tag Off When activated, a PHP block can be started with <? samely than with <?php. Since not every server is configured to accept short opening tags, it is a good practice to deactivate this directive and avoid writing short opening tags.
track_errors On for debugging, Off for production When activated, the PHP interpreter stores an error message in the global variable $php_errormsg when a problem is encountered.
upload_max_filesize 2M The maximum file size allowed for a file sent via form. Not recommended to increase this value unless it is required.