PHP Accelerator eaccelerator configuration parameters, API detailed _php tips

Source: Internet
Author: User

It is also able to optimize scripts to speed up their execution. Using Eaccelerator can reduce server load and increase the execution time of PHP code.

Eaccelerator configuration options:

Copy Code code 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″


Eaccelerator configuration parameters are described in detail:

Eaccelerator.shm_size

Specifies the amount of shared memory that Eaccelerator can use in megabytes (MB). "0″ represents the operating system defaults. The default value is 0″.

Eaccelerator.cache_dir

Directory for user disk caching. Eaccelerator Stores precompiled code, session data, content, and so on in this directory. The same data can also be stored in shared memory (for faster access speed). The default value is "/tmp/eaccelerator".

Eaccelerator.enable

Turn eaccelerator on or off. "1″ is turned on," 0″ is closed. The default value is 1″.

Eaccelerator.optimizer

Turn on or off the internal optimizer to increase code execution speed. "1″ is turned on," 0″ is closed. The default value is 1″.

Eaccelerator.debug

Turn debug logging on or off. "1″ is turned on," 0″ is closed. The default value is 0″.

Eaccelerator.check_mtime

Turn on or off the PHP file change check. "1″ is turned on," 0″ is closed. If you want to recompile your PHP program after you modify it, 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 not cached file types (such as "*.php *.phtml", and so on), and if the parameters start with "!", the files that match the parameters are ignored for caching. The default value is "", that is, all PHP files will be cached.

Eaccelerator.shm_max

Prevents large files from being stored in shared memory when the Eaccelerator_put () function is used. This parameter specifies the maximum value that is allowed to be stored, in bytes (10240, 10K, 1M). "0″ is not limited." The default value is 0″.

Eaccelerator.shm_ttl

When Eaccelerator fails to get the shared memory size of the new script, it deletes all script caches that are inaccessible in the last "Shm_ttl" seconds from the shared memory. The default value is 0″, which is: Do not delete any cached files from the shared spring.

Eaccelerator.shm_prune_period

When Eaccelerator fails to get the shared memory size of the new script, he attempts to remove cache scripts older than "Shm_prune_period" from shared memory. The default value is 0″, which is: Do not delete any cached files from the shared spring.

Eaccelerator.shm_only

Allows or disables caching of compiled scripts on disk. This option is not valid for session data and content caching. The default value is 0″, which is: caching with disk and shared memory.

Eaccelerator.compress

Allows or disables the compression of content caching. The default value is 1″, which is: Allow compression.

Eaccelerator.compress_level

Specifies the compression level for the content cache. The default value is 9″, which is the highest level.

Eaccelerator.name_sapce

A prefix string for all keys (keys). If the prefix string is set, the. htaccess or the primary configuration file is allowed to run two identical key names on the same host.

Eaccelerator.keys
Eaccelerator.sessions
Eaccelerator.content

Determine which keys (keys), session data, and content will be cached. The available parameter values are:

1. "Shm_and_disk" – caching data simultaneously in shared memory and on disk (default value);
2. "SHM" – Caching data in shared memory or disk if the shared memory is exhausted or the data capacity is greater than "Eaccelerator.shm_max";
3. "Shm_only" – Caching data only in shared memory;
4. "Disk_only" – Caching data only on disk;
5. "None"-disables caching of data.


Eaccelerator Application Interface (API):

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

Stores the $value in shared memory and stores $tll seconds.

Eaccelerator_get ($key)

Returns the cached value stored by the Eaccelerator_put () function from shared memory, or null if it does not exist or has expired.

EACCELERATOR_RM ($key)

Deletes the $key from shared memory.

EACCELERATOR_GC ()

Delete all expired keys (keys)

Eaccelerator_lock ($lock)

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

Eaccelerator_unlock ($lock)

Unlocks the specified name (lock).

Eaccelerator_set_session_handlers ()

Installs the eaccelerator session handle. After you have 4.2.0 from PHP, you can install the Eaccelerator handle by setting "Session.save_handler=eaacelerator" in php.ini.

Eaccelerator_cache_output ($key, $eval _code, $ttl =0)

$eval _code output is cached in shared memory, $ttl seconds are cached. You can call the MMCACH_RM () function to delete output from the same $key. For example:

Eaccelerator_cache_result ($key, $eval _code, $ttl =0)

Cache $eval _code results in shared memory, $ttl seconds cached. You can call the MMCACH_RM () function to delete the results of the same $key. For example:

Eaccelerator_cache_page ($key, $ttl =0)

The entire page is cached and $ttl seconds are cached. For example:

Eaccelerator_rm_page ($key)

Deletes the same $key page created by the Eaccelerator_cache_page () function from the cache.

Eaccelerator_encode ($filename)

Returns the compiled encoding of the $filename file.

Eaccelerator_load ($code)

Loads 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.