December 2012

Php Configuration File (php.ini)

The 'php.ini' file is the default configuration file for running applications that require PHP. It is used to control variables such as script execution time, upload sizes etc. Some common setting variables with description are as follows:

Category Variable Default Value Description
Register Global register_globals Off Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables. For more detail read here
File Upload file_uploads On Whether to allow HTTP file uploads.
upload_tmp_dir NULL Temporary directory for HTTP uploaded files (will use system default if not specified).
upload_max_filesize 2M Maximum allowed size for uploaded files. PHP allows shortcuts for bit values, including K (kilo), M (mega) sand G (giga).
max_file_uploads 20 The maximum number of files allowed to be uploaded simultaneously.
Post post_max_size 8M Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than 'upload_max_filesize'. Default value is 8Mb.
Session session.gc_maxlifetime 1440 Default sessin time in php. The default value is on seconds (1440 sec = 24 min)
session.auto_start 0 Initialize session on request startup.(Turning on session support automatically at site level)
Resource Limit max_execution_time 30 Maximum execution time of each script, in seconds.
Error Reporting error_reporting E_ALL Display types of error. E_ALL display all types of error.

Full directives can be found at here (php official website).

Types of error in PHP

There are three basic types of runtime errors in PHP :

  1. Notices
    These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior.  

  2. Warnings
    These are more serious errors - for example, attempting to include () a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination. 

  3. Fatal Errors
    These are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP's default behavior is to display them to the user when they take place. 
        
Internally, these variations are represented by twelve different error types. 

  1. E_ERROR: A fatal error that causes script termination.
  2. E_WARNING: Run-time warning that does not cause script termination.
  3. E_PARSE: Compile time parse error.
  4. E_NOTICE: Run time notice caused due to error in code.
  5. E_CORE_ERROR: Fatal errors that occur during PHP's initial start-up (installation).
  6. E_CORE_WARNING: Warnings that occur during PHP's initial start-up.
  7. E_COMPILE_ERROR: Fatal compile-time errors indication problem with script.
  8. E_USER_ERROR: User-generated error message.
  9. E_USER_WARNING: User-generated warning message.
  10. E_USER_NOTICE: User-generated notice message.
  11. E_STRICT: Run-time notices.
  12. E_RECOVERABLE_ERROR: Catchable fatal error indicating a dangerous error 
  • E_ALL: Catches all errors and warnings

Newer Posts Older Posts

Related Posts Plugin for WordPress, Blogger...
Powered by Blogger.