Configuration parameters and API details of php accelerator eAccelerator

Source: Internet
Author: User
EAccelerator is an open-source PHP accelerator that optimizes programs, encoders, and dynamic content caching. It caches PHP scripts during compilation to improve the performance of PHP scripts, therefore, the system overhead can be almost eliminated during compilation. It can also optimize scripts to accelerate their execution speed. Using eAccelerator can reduce the server load and increase the execution time of PHP code.

EAccelerator configuration options:

The code is as follows:


Zend_extension_ts = "X: Appphp-5.2.13-Win32exteaccelerator.dll"
Eaccelerator. shm_size = "32 ″
Eaccelerator. cache_dir = "X: Appphp-5.2.13-Win32 emp"
Eaccelerator. enable = "1 ″
Eaccelerator. optimizer = "1 ″
Eaccelerator. check_mtime = "1 ″
Eaccelerator. debug = "0 ″
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0 ″
Eaccelerator. shm_ttl = "0 ″
Eaccelerator. shm_prune_period = "0 ″
Eaccelerator. shm_only = "0 ″
Eaccelerator. compress = "1 ″
Eaccelerator. compress_level = "9 ″
Zend_extension_manager.optimizer_ts = "X: AppendendOptimizer-3.3.0libOptimizer-3.3.0 ″
Zend_extension_ts = "X: AppendendOptimizer-3.3.0libendExtensionManager.dll"
Zend_optimizer.optimization_level = "512 ″


Detailed descriptions of eAccelerator configuration parameters:

Eaccelerator. shm_size

Specify the amount of shared memory that eAccelerator can use. unit: MB. "0" indicates the default operating system. The default value is "0 ″.

Eaccelerator. cache_dir

The directory cached by your disk. The eAccelerator stores pre-compiled code, session data, and content in this directory. The same data can also be stored in the shared memory (for faster access ). The default value is "/tmp/eaccelerator ".

Eaccelerator. enable

Enable or disable eAccelerator ." 1 "indicates enabled, and" 0 "indicates disabled. The default value is "1 ″.

Eaccelerator. optimizer

Enabling or disabling the internal optimizer can speed up code execution ." 1 "indicates enabled, and" 0 "indicates disabled. The default value is "1 ″.

Eaccelerator. debug

Enable or disable debugging logging ." 1 "indicates enabled, and" 0 "indicates disabled. The default value is "0 ″.

Eaccelerator. check_mtime

Enable or disable PHP file change check ." 1 "indicates enabled, and" 0 "indicates disabled. If you want to re-compile the PHP program after modification, you need to set it to "1 ″. The default value is "1 ″.

Eaccelerator. filter

Determine which PHP files must be cached. You can specify the cached and non-cached file types (for example, "*. php *. phtml"). Files that match these parameters are ignored. The default value is "", that is, all PHP files will be cached.

Eaccelerator. shm_max

When the "eaccelerator_put ()" function is used, it is prohibited to store excessive files in the shared memory. This parameter specifies the maximum value that can be stored, in bytes (10240, 10 K, 1 M )." 0 "is unlimited. The default value is "0 ″.

Eaccelerator. shm_ttl

When the eAccelerator fails to obtain the shared memory size of the new script, it will delete all script caches that cannot be accessed in the last "shm_ttl" seconds from the shared memory. The default value is "0", that is, no cached files are deleted from the shared files in the spring.

Eaccelerator. shm_prune_period

When the eAccelerator fails to obtain the shared memory size of the new script, it will try to delete the cache script earlier than "shm_prune_period" from the shared memory. The default value is "0", that is, no cached files are deleted from the shared files in the spring.

Eaccelerator. shm_only

Allow or disable caching compiled scripts on disks. This option is invalid for session data and content caching. The default value is "0", that is, the disk and shared memory are used for cache.

Eaccelerator. compress

Allows or disables content caching. The default value is "1", that is, compression is allowed.

Eaccelerator. compress_level

Specifies the compression level of the content cache. The default value is "9", which is the highest level.

Eaccelerator. name_sapce

A prefix string of all keys. If this prefix is set, the. htaccess or master configuration file can run two identical key names on the same host.

Eaccelerator. keys
Eaccelerator. sessions
Eaccelerator. content

Determine which keys, session data, and content will be cached. Available parameter values:

1. "shm_and_disk"-cache data in both the shared memory and disk (default );
2. "shm"-if the shared memory is used up or the data capacity is greater than "eaccelerator. shm_max", the data is cached in the shared memory or disk;
3. "shm_only"-only cache data in the shared memory;
4. "disk_only"-only cache data on the disk;
5. "none"-disable data caching.


EAccelerator application interface (API ):

Eaccelerator_put ($ key, $ value, $ ttl = 0)

Store $ value in shared memory and $ tll seconds.

Eaccelerator_get ($ key)

Return the cache value stored by the eaccelerator_put () function from the shared memory. if it does not exist or has expired, return null.

Eaccelerator_rm ($ key)

Delete $ key from the shared memory.

Eaccelerator_gc ()

Delete all expired keys (keys)

Eaccelerator_lock ($ lock)

Creates a lock with the specified name ). The lock can be removed through the eaccelerator_unlock () function, and is automatically unlocked at the end of the request. For example:

Eaccelerator_unlock ($ lock)

Removes the lock of the specified name ).

Eaccelerator_set_session_handlers ()

Install the eAccelerator session handle. After PHP 4.2.0, you can install the eAccelerator handle by setting "session. save_handler = eaacelerator" in php. ini.

Eaccelerator_cache_output ($ key, $ eval_code, $ ttl = 0)

Cache $ eval_code output in the shared memory, and cache $ ttl seconds. You can call the mmcach_rm () function to delete the output with the same $ key. For example:

Eaccelerator_cache_result ($ key, $ eval_code, $ ttl = 0)

Cache $ eval_code results in the shared memory and $ ttl seconds. You can call the mmcach_rm () function to delete results with the same $ key. For example:

Eaccelerator_cache_page ($ key, $ ttl = 0)

Cache the entire page and cache $ ttl seconds. For example:

Eaccelerator_rm_page ($ key)

Delete the pages with the same $ key created by the eaccelerator_cache_page () function from the cache.

Eaccelerator_encode ($ filename)

Returns the encoding of the $ filename File after compilation.

Eaccelerator_load ($ code)

Load the script encoded by the eaccelerator_encode () function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.