Detailed explanation of the installation and use of eAccelerator_PHP tutorial

WBOY
Release: 2016-07-21 15:07:17
Original
781 people have browsed it

1. PHPeAccelerator installation
Go to https://github.com/eaccelerator/eaccelerator/downloads to download the latest version of the installation package, unzip the installation package, and enter the decompressed Folder directory,

Compile:

Copy code The code is as follows:

$PHP_PREFIX/bin/phpize
./configure--enable-shared --with-php-config=$PHP_PREFIX/bin/php-config
make

Installation:
Copy the code The code is as follows:

makeinstall

Modify php.ini:
Copy code The code is as follows:

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug=" 0"
eaccelerator.filter=""
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"

Create a new cache directory:
Copy the code The code is as follows:

mkdir/tmp/eaccelerator
chmod0777 /tmp/eaccelerator

二、PHPeAccelerator配置选项
eaccelerator.shm_size
用来设置分配给eAccelerator用来缓存php的最大共享内存,单位是mb,如果设置为0,就使用默认大小。在linux系统中一个process能分配的最大内存是由/proc/sys/kernel/shmmax限制的,所以如果eA设置的内存超出了这个值,eA在初始化的时候会失败。shmmax的单位是字节(bytes

eaccelerator.cache_dir
用来设置硬盘缓存目录。eA用来存放预编译代码,session数据,内容和用户入口。默认值是"/tmp/eaccelerator"

eaccelerator.enable
用来设置是否启用或禁用eAccelerator,设置1为启用,设置0为禁用。

eaccelerator.optimizer
开启或关闭优化,用户加速代码的执行。1为开启,0为关闭,优化仅仅在脚本被编译时候发生并且是在被缓存之前。

eaccelerator.debug
开启关闭debug日志。如果设置为1,将打印很多文件命中的信息到日志中。这个在排查eAccelerator的时候很有用。

eaccelerator.check_mtime
在每次命中的时候Eaccelerator都会检查脚本的修改时间来判断是不是脚本发生的变化来决定是否需要重新编译。尽管检查比打开文件并编译要快,但仍然会带来一些开销的,因为每次都会有状态调用要完成。这个配置可以关闭这个检查。不过关闭检查带来的不利就是每次更新了文件需要认为手动的清除cache。默认检查是启用的,1是启用,0是禁用。

eaccelerator.filter
is used to determine which php file is cached. You can match php scripts that need to be cached by using wildcards (such as "*.php*.phtml"). If it starts with "!", it means there is no match. This parameter is empty by default and can cache all compiled php script needs Note that eaccelerator.filter does not work based on URL, but based on the absolute path of the file, such as defining "!/home", then all scripts in the /home directory will not be cached. If you want to define multiple matches, separate them with spaces or tabs, not commas.

eaccelerator.shm_ttl
When eAcelerator has no free shared memory, Scripts that have not been accessed for at least shm_ttl seconds will be released from the cache. The default value is 0, which means eA will not release any cache.

eaccelerator.shm_prune_period
When there is not enough memory for caching, eA Will try to clear the expired script again when the last time the cache was cleared exceeds the number of seconds set by shm_prune_period. The default value is 0, eA will not clear expired scripts from cache.

eaccelerator.shm_only
Enable or disable disk cache. This option has no effect on caching of session data and content. The default value is 0, allowing eA to use disk and memory for caching.

eaccelerator.allowed_admin_path
Enable or disable disk cache. This option has no effect on caching of session data and content. The default value is 0, allowing eA to use disk and memory for caching.

3. PHPeAccelerator monitoring and management
eAccelerator provides control.php for monitoring and managing eAccelerator cache. Place control.php in the website directory, modify the account number and password, and then you can monitor and manage the eAccelerator cache through the browser.
Lines 23 and 24 of control.php:

Copy code The code is as follows:

$user= "admin";
$pw= "password";

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327573.htmlTechArticle1. To install PHPeAccelerator, go to https://github.com/eaccelerator/eaccelerator/downloads to download the latest version of the installation package. Unzip the installation package, enter the unzipped folder directory, compile: Copy...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!