php.ini : Most commonly used php directives

Below are the most commonly used php directives. You have to change php.ini file in order to configure php settings. This just means changing these directive’s option and value.

1) short_open_tag = Off

Allow the many servers don’t support short tags.

2) max_execution_time = 30

Maximum execution time of each script, in seconds

3) error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

This shows all errors, except coding standards warnings. Some more examples for error_reporting setting:

– Show all errors, except for notices and coding standards warnings
error_reporting = E_ALL & ~E_NOTICE

– Show all errors, except for notices
error_reporting = E_ALL & ~E_NOTICE | E_STRICT

– Show only errors
error_reporting= E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

4) display_errors = On

Print out errors (as a part of the output). For production web sites, you’re strongly encouraged to turn this feature off, and use error logging instead (see below). Keeping display_errors enabled on a production web site may reveal security information to end users, such as file paths on your Web server, your database schema or other information.

5) log_errors = On

Log errors into a log file (server-specific log, stderr, or error_log (below)). As stated above, you’re strongly advised to use error logging in place of error displaying on production web sites.

6) register_globals = Off

You should do your best to write your scripts so that they do not require register_globals to be on.

Using form variables as globals can easily lead to possible security problems, if the code is not very well thought of.

7) memory_limit = 128M

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.

8) post_max_size = 8M

Maximum size of POST data that PHP will accept. In the above example Post max size is 8MB.

This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size .

9) file_uploads = On

Whether to allow HTTP file uploads.

10) upload_max_filesize = 2M

Maximum allowed size for uploaded files. In above case, 2MB.

11) allow_url_fopen = On

Whether to allow the treatment of URLs (like http:// or ftp://) as files.

Cheers n Enjoy PHPing !!