Most PHP programs install accelerators on the server to improve program efficiency. The eaccelerator accelerator we introduced is actually a free software and is still free of charge. It is also a good choice to save service setup costs;
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. Improve the code execution efficiency of your PHP program 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. The official website is eaccelerator-0.9.6.1.tar.gz.
2.1 compile and install;
# Tar zxvf eaccelerator-0.9.6.1.tar.gz
# 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: the specific position of the module must be correct. Refer to your system. You can adjust the shared memory size by yourself. You can adjust the size of the shared memory by 16 Mb. 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: The permission for creating a cache directory pool is 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 feel good when using jiankli.com. 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, jiankli.com has been in use for several years and has also used TurckMMCache, the predecessor of eaccelerator.
4. references;
README document of eaccelerator;