You are currently viewing Zend Server 5.x documentation. Click here to view the latest Zend Server online documentation.
You are here: Zend Server Best Practices > Performance > Configuring PHP for Performance

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 Administration Interface via Server Setup | Directives.

Warning:

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 for IBMi 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_long_arrays

Off

Off

Tells PHP whether or not to register the deprecated long $HTTP_*_VARS type predefined variables. When On (default), long predefined PHP variables (like $HTTP_GET_VARS) are defined. If you are not using them, it's recommended to turn them off for performance reasons. Instead, use the superglobal arrays (like $_GET). This directive became available in PHP 5.0.0 and was dropped in PHP 6.0.0.

register_argc_argv

Off

Off

Tells PHP whether to declare the argv and argc variables (that contain the GET information).

magic_quotes_gpc

The default is: Off

This feature is deprecated as of PHP 6.0.0.

Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are On, all ' (single-quote), " (double quote), \ (backslash) and NULLs are escaped with a backslash automatically.

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.

 

 

 

Related Links

Related Links:

Introduction - to the API Reference

Reference Information - for PHP developers

 

 

 

 

© 1999-2013 Zend Technologies, Ltd. All rights reserved.