Home >Backend Development >PHP Tutorial >Detailed explanation of the installation and use of eAccelerator_PHP tutorial
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:
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: