Configuring PHP for Performance
You may be able to add an additional performance boost to your PHP applications by properly configuring your PHP runtime environment settings. You can edit the directives below from the User Interface by going to PHP | Extensions.
Important:
Changing some of these settings may cause certain PHP applications to stop functioning. Therefore, use discretion when you disable them and test your environment: It is important that you fully understand the purpose of each directive before you modify it.
Optimal php.ini configurations and settings for maximum performance optimization:
Name |
Recommended Value |
Zend Server Default |
Description |
realpath_cache_size |
256K |
256K |
Determines the size of the realpath cache to be used by PHP. This value should be increased on systems where PHP opens many files, to reflect the quantity of the file operations performed. |
realpath_cache_ttl |
120 |
120 |
Duration (in seconds) for which to cache realpath information for a given file or directory. For systems with rarely changing files, consider increasing the value. |
error_reporting |
E_ALL & ~E_NOTICE |
E_ALL |
The error_reporting() function sets the error_reporting directive at runtime. PHP has many levels of errors: Using this function sets the error level for the duration (runtime) of your script. |
register_argc_argv |
Off |
Off |
Tells PHP whether to declare the argv and argc variables (that contain the GET information). |
include_path |
As short as possible, depending on the application's needs |
".;/path/to/php/pear" |
Specifies a list
of directories where the require(), include(), fopen(), file(),
readfile() and file_get_contents() functions look for files. The
format is like the system's PATH environment variable: A list
of directories separated with a colon in Unix |
max_execution_time |
30 |
30 |
This sets the maximum time (in seconds) that a script is allowed to run before it is terminated by PHP. This helps prevent poorly written scripts from tying up the server. The default setting is 30 s. When running PHP from the command line, the default setting is 0 s. The maximum execution time is not affected by system calls, stream operations, etc. See the set_time_limit() function for more details. You cannot change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or to change the time limit in the php.ini. Your Web server may have other timeout configurations that can also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your Web server documentation for specific details. |
memory_limit |
128M |
128M |
Sets the maximum amount of memory (in bytes) that a script can allocate. This helps prevent poorly written scripts from consuming all the available memory on a server. This setting can also be fine-tuned during development to reach an optimal setting. When an integer is used, the value is measured in bytes. Note: To have no memory limit, set this directive to -1. |
output_buffering |
4096 |
4096 |
Allows you to buffer the PHP output instead of having it sent directly as soon as it is generated. |