1. Introduction to PhP accelerator eaccelerator;
Eaccelerator is a free and open source PHP accelerator. It optimizes and dynamically caches content, improves the cache performance of PHP scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. Make your phpProgramCodeThe execution efficiency can be improved by 1-10 times;
Official homepage:Http://eaccelerator.net
2. installation and configuration;
First, you must install PHP and then compile and install eaccelerator. The procedure is as follows. Our official version from below is eaccelerator-0.9.5.2.tar.bz2
2.1 compile and install;
# Tar xvf eaccelerator-0.9.5.2.tar.bz2
# Cd eaccelerator-0.9.5.2
# Export php_prefix = "/usr"
# $ Php_prefix/bin/phpize
#./Configure/
-- Enable-eaccelerator = shared/
-- With-PHP-Config = $ php_prefix/bin/PHP-config
# Make
# Make install
Note:Use Export to set the installation path variable of PHP. My PHP is installed in the/usr directory, and the system uses slackware 12.0. For other systems, the default installation method is similar. For different systems, specify the default one;
After installation, the eaccelerator. So module is located in the/usr/lib/PHP/extensions directory. If your system is different from mine, where should you install it yourself;
# Echo "/usr/lib/PHP/extensions">/etc/lD. So. conf
# Ldconfig
Note:Update the dynamic link library address;
2.2 modify the configuration file;
First, modify PHP. ini and restart Apache;
In the php. ini file, add;
Zend_extension = "/usr/lib/PHP/extensions/eaccelerator. So" NOTE: the specific position of the module;
Eaccelerator. shm_size = "16" NOTE: shared memory size;
Eaccelerator. cache_dir = "/home/eaccelerator" NOTE: cache directory;
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"
Note:Here, the specific position of the module must be correct. Your system prevails. You can adjust the shared memory size by yourself. 16 Mb is acceptable. you can adjust it by yourself based on the server situation. You can specify the cache directory by yourself. Here we specify the eaccelerator directory on the/home directory. If not, create one by yourself. The permission is 0777;
The above configuration is to compile the eaccelerator as the Zend extension module. If your PHP is compiled in installation mode, change zend_extension to zend_extension_ts.
If you use eaccelerator as an extension of PHP, use the following configuration;
Extension = "eaccelerator. So"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir = "/home/eaccelerator"
Eaccelerator. Enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Check whether it is effective. In the/home/eaccelerator directory, when the Apache server is started, you can click a few pages. If the directory contains a file. It takes effect. If there are no files, you have to find the reason ......
Are these two configuration files useful. You need to modify it as needed.
# Mkdir/home/eaccelerator
# Chmod 777/home/eaccelerator
Note:Create a cache directory pool with the permission of 777
After all this is done, restart the Apache server. If no error is displayed, most of them are correct. Check the cache pool and click a few pages to see if it works. It seems to be relatively simple.
3. About this article;
This document introduces the PHP accelerator eaccelerator. I only pay attention to the results. I still feel good when using linuxsir. org. Because it is used, we will introduce this to new users or new colleagues who are engaged in server management. There are many PHP accelerators, but with free software, eaccelerator is one of them that does not need to be spent on development. Therefore, I am still responsible for introducing this item to you ~~~ Of course, linuxsir. Org has been used for several years, and also used turckmmcache, the predecessor of eaccelerator.
4. references;
Readme document of eaccelerator;