PHP Accelerator eaccelerator Installation

Source: Internet
Author: User
Tags phpinfo zend

Program Description

Eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, improving the caching performance of PHP scripts, so that PHP scripts in the compiled state, the cost of the server is almost zero. It also has the effect of optimizing the script to speed up its execution efficiency. Make your PHP program code 1-10 times more efficient to practice. The cost of eaccelerator itself is very small.

1. Program Download

# # #服务器上之间下载 # #

[Email protected]web-yv3 ~]# wget https://github.com/eaccelerator/eaccelerator/tarball/master

[email protected] ~]# LL

-rw-r--r--1 root root 131579 Nov 17:34 master #此文件就是下载的eAccelerator的安装包, don't be surprised!!

# # #官网自行下载 # #

http://eaccelerator.net/

Eaccelerator-eaccelerator-42067ac.tar.gz

Via RZ upload or FTP upload!!

2. Compile and install the accelerator

2.1. Decompression procedure

[[Email protected] ~] #tar XF Master #常规方式解压

[[email protected] ~]# ls

EACCELERATOR-EACCELERATOR-42067AC Master

[Email protected] ~]# CD EACCELERATOR-EACCELERATOR-42067AC #已经露出了庐山真面目!

2.2. View Phpize

Phpize is used to extend the PHP extension module, through the phpize can build PHP plug-in module.

[Email protected] ~]# CD EACCELERATOR-EACCELERATOR-42067AC

[Email protected] eaccelerator-eaccelerator-42067ac]# Whereis phpize

Phpize:/usr/bin/phpize/usr/share/man/man1/phpize.1.gz

2.3, the implementation of Phpize

[Email protected] eaccelerator-eaccelerator-42067ac]#/usr/bin/phpize

Configuring for:

PHP Api version:20100412

Zend Module Api no:20100525

Zend Extension Api no:220100525

2.4. View Php-config

[Email protected] eaccelerator-eaccelerator-42067ac]# Whereis php-configphp-config:/usr/bin/php-config/usr/share/ Man/man1/php-config.1.gz

2.5. Compile and install

[Email protected] eaccelerator-eaccelerator-42067ac]#/configure--enable-eaccelerator=shared--with-php-config=/ Usr/bin/php-config

[[email protected] eaccelerator-eaccelerator-42067ac]# make

[[email protected] eaccelerator-eaccelerator-42067ac]# make install

Installing shared extensions:/usr/lib64/php/modules/# #记录此安装位置

+-------------------------------------------------------+

| !!!                    Attention!!! |

| |

| For disk cache users (using eaccelerator.shm_only=0): |

| |

| Remember to empty your eaccelerator disk cache |

|          When upgrading, otherwise things would break! |

+-------------------------------------------------------+

2.6. Setting Configuration Files

[Email protected] 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. configuration file parsing

extension= "/usr/lib64/php/modules/eaccelerator.so" #加载eaccelerator模块

Eaccelerator.shm_size= #用来设置分配给eAccelerator用来缓存php的最大共享内存, the unit is MB, and if set to 0, the default size is used.

Eaccelerator.cache_dir= "/data/eaccelerator_cache" #用来设置硬盘缓存目录. The EA is used to store pre-compiled code, session data, content, and user portals. The default value is "/tmp/eaccelerator".

eaccelerator.enable= "1" #用来设置是否启用或禁用eAccelerator, set 1 to Enabled, and set 0 to Disabled.

Eaccelerator.optimizer= "1" #开启或关闭优化, the user accelerates the execution of the code. 1 is on, 0 is off, optimization occurs only when the script is compiled and before it is cached.

Eaccelerator.check_mtime= "1" #在每次命中的时候Eaccelerator都会检查脚本的修改时间来判断是不是脚本发生的变化来决定是否需要重新编译. At each hit, Eaccelerator will check the script's modification time to determine if the script has changed to determine if it needs to be recompiled.

eaccelerator.debug= "0" #开启关闭debug日志. If set to 1, many file hits are printed in the log.

Eaccelerator.filter= "" #用来决定哪个php文件被缓存. You can match the PHP script that needs to be cached by using wildcards such as "*.php *.phtml". If you use "!" The start, which indicates that the parameter is not matched, is empty by default, such as "!/home" is defined, then all scripts of the/home directory will not be cached. If you want to define more than one match, use spaces or tabs to separate instead of commas.

eaccelerator.shm_max= "0" #设置内存缓存可以缓存文件的最大值

Eaccelerator.shm_ttl= "0" #当eAcelerator没有空余的共享内存的时候, the number of seconds that the minimum Shm_ttl setting is not accessed is freed from the cache, and the default value is 0. Indicates that the EA will not release any caches.

eaccelerator.shm_prune_period= "0" #当没有足够的内存用来缓存的时候, the EA will try to clear the expired Shm_prune_period again when the cache has been cleared for more than the number of seconds set by the last time The script. The default value of 0,ea will not purge expired scripts from the cache.

eaccelerator.shm_only= "0" #启用或者禁用磁盘缓存. This option has no effect on the cache of session data and content. The default value is 0, which allows the EA to use disk and memory for caching.

eaccelerator.compress= the "1" #当使用eaccelerator_content_ * API, the EA can compress the content before caching. The default value of 1 means enabled and disabled to 0.

Eaccelerator.compress_level= "9" #内容缓存的压缩等级. The default value is 9, which is the maximum compression level.

2.8. Create and authorize cache directories

[Email protected] eaccelerator-eaccelerator-42067ac]# Mkdir/data/eaccelerator_cache[[email protected] eaccelerator-eaccelerator-42067ac]# chown Deploy.deploy eaccelerator_cache/-R

2.9. Restart PHP

[Email protected] ~]# service PHP-FPM restart

2.10, through Phpinfo view

[Email protected] html]# VI phpinfo.php

Echo Phpinfo ();

?>

3. Managing the Cache

3.1. Manage cache via server

[Email protected] eaccelerator_cache]# lldrwx------Deploy deploy 4096 Nov 29 19:41 500

3.2. Manage cache via built-in page

Eaccelerator the address of the Control Panel, The installation package has a control.php file, copy it to any directory of the site, you can use it to view and manage, this must be specified, otherwise when viewing the cache content error, access time Default user name is: admin, Password: eaccelerator

    • This article is from: Linux Tutorial Network

PHP Accelerator eaccelerator installation

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.