Install PHP accelerator eAccelerator

Source: Internet
Author: User

Install PHP accelerator eAccelerator

Program description

EAccelerator is a free and open source php accelerator. It optimizes and dynamically caches content, improves the cache performance of php scripts, and makes PHP scripts have almost zero server overhead during compilation. It also optimizes scripts to accelerate execution efficiency. Improve the code execution efficiency of your PHP program by 1-10 times. The cost of the eAccelerator is also very small.

1. program download

### Download between servers ###
[Root @ web-yv3 ~] # Wget https://github.com/eaccelerator/eaccelerator/tarball/master
[Root @ web-yv3 ~] # Ll
-Rw-r -- 1 root 131579 Nov 29 master # This file is the downloaded eAccelerator installation package. Do not be surprised !!
### Download from the official website ###
Http://eaccelerator.net/
Eaccelerator-eaccelerator-42067ac.tar.gz
Upload via rz or ftp !!

2. Compile and install the accelerator

2.1 decompress the program

[Root @ web-yv3 ~] # Tar xf master # General Decompression
[Root @ web-yv3 ~] # Ls
Eaccelerator-eaccelerator-42067ac master
[Root @ web-yv3 ~] # Cd eaccelerator-eaccelerator-42067ac # has revealed the true face of the mountains!

2.2 view phpize

Phpize is used to expand the php extension module. phpize can be used to establish a php plug-in module.


[Root @ web-yv3 ~] # Cd eaccelerator-eaccelerator-42067ac
[Root @ web-yv3] # whereis phpize
Phpize:/usr/bin/phpize/usr/share/man/man1/phpize.1.gz

2.3 run phpize


[Root @ web-yv3 eaccelerator-eaccelerator-42067ac] #/usr/bin/phpize
Processing ing:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

2.4 view php-config

[Root @ web-yv3] # whereis php-config
Php-config:/usr/bin/php-config/usr/share/man/man1/php-config.1.gz

2.5 compile and install

[Root @ web-yv3 eaccelerator-eaccelerator-42067ac] #./configure -- enable-eaccelerator = shared -- with-php-config =/usr/bin/php-config
[Root @ web-yv3] # make
[Root @ web-yv3] # make install
Installing shared extensions:/usr/lib64/php/modules/# record the installation location
+ --------------------------------------------------------- +
| !!! Attention !!! |
|
| For disk cache users (using eaccelerator. shm_only = 0): |
|
| Please remember to empty your eAccelerator disk cache |
| When upgrading, otherwise things will break! |
+ --------------------------------------------------------- +

2.6 set the configuration file

[Root @ web-yv3 eaccelerator-eaccelerator-42067ac] # vi/etc/php. ini
Extension = "/usr/lib64/php/modules/eaccelerator. so"
Eaccelerator. shm_size = "64"
Eaccelerator. cache_dir = "/data/eaccelerator_cache"
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_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"

2.7 parsing configuration files

Extension = "/usr/lib64/php/modules/eaccelerator. so" # load the eaccelerator Module
Eaccelerator. shm_size = "64" # used to set the maximum shared memory allocated to eAccelerator to cache php. The unit is mb. If it is set to 0, the default size is used.
Eaccelerator. cache_dir = "/data/eaccelerator_cache" # used to set the hard disk cache directory. EA is used to store pre-compiled code, session data, content, and user portals. The default value is "/tmp/eaccelerator ".
Eaccelerator. enable = "1" # used to set whether to enable or disable eAccelerator, set 1 to enable, and set 0 to disable.
Eaccelerator. optimizer = "1" # enable or disable optimization to accelerate code execution. 1 is enabled, 0 is disabled, and optimization only occurs when the script is compiled and before it is cached.
Eaccelerator. check_mtime = "1" # during each hit, Eaccelerator checks the modification time of the script to determine whether the script has changed and whether re-compilation is required. During each hit, the Eaccelerator checks the modification time of the script to determine whether the script has changed and whether re-compilation is required.
Eaccelerator. debug = "0" # enable and Disable debug logs. If it is set to 1, the hit information of many files will be printed into the log.
Eaccelerator. filter = "" # used to determine which PHP file is cached. You can use wildcards (for example, "*. php *. phtml") to match the php script to be cached. If "! ", Indicating that the parameter does not match. This parameter is blank by default. For example, it is defined "! /Home ", all scripts in the/home directory will not be cached. To define multiple matches, use spaces or tabs instead of commas.
Eaccelerator. shm_max = "0" # set the maximum value of files that can be cached in the memory cache.
Eaccelerator. shm_ttl = "0" # When the eAcelerator has no spare shared memory, the script that has not been accessed in the shm_ttl setting in seconds will be released from the cache. The default value is 0, indicates that eA will not release any cache.
Eaccelerator. shm_prune_period = "0" # when there is not enough memory for caching, eA will attempt to clear expired scripts again when the last time the cache is cleared exceeds the number of seconds set by shm_prune_period. The default value is 0. eA will not clear expired scripts from the cache.
Eaccelerator. shm_only = "0" # enable or disable disk caching. This option has no effect on the cache of session data and content. The default value is 0, which allows eA to cache data using disks and memory.
Eaccelerator. compress = "1" # when using the eaccelerator_content _ * api, eA can compress the content before caching. The default value is 1.
Eaccelerator. compress_level = "9" # Content cache compression level. The default value is 9, which is the maximum compression level.

2.8 create and authorize a cache directory

[Root @ web-yv3 eaccelerator-eaccelerator-42067ac] # mkdir/data/eaccelerator_cache
[Root @ web-yv3 eaccelerator-eaccelerator-42067ac] # chown deploy. deploy eaccelerator_cache/-R

2.9 restart PHP

[Root @ web-yv3 ~] # Service php-fpm restart

2.10 view through phpinfo

[Root @ web-yv3 html] # vi phpinfo. php
<? Php
Echo phpinfo ();
?>

 

3. Manage Cache

3.1 manage cache through Server

[Root @ eaccelerator_cache] # ll
Drwx ------ 18 deploy 4096 Nov 29 19:41 500

3.2 manage cache through built-in pages

The address of the eAccelerator control panel. The installation package contains a control. PHP file, copy it to any directory of the website, you can use it to view and manage, this must be specified, otherwise there will be errors when viewing the cache content, access the default user name is: admin, password: eAccelerator

 

This article permanently updates the link address:

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.