Eaccelerator Configuration (PHP code accelerator)
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 almost completely eliminated. It also has the effect of optimizing the script to speed up its execution efficiency. Increase your PHP program code efficiency by up to 1-10 times;
?
First you have to install PHP, and then to compile and install eaccelerator, the process is as follows.
We're from the official version of the eaccelerator-0.9.5.2.tar.bz2.
Compile and install;
# tar XVF eaccelerator-0.9.5.2.tar.bz2
# CD 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: By using export to set the location of the PHP installation path variable, my PHP is installed in the/USR directory, the system with Redhat. Other systems if the default installation is also roughly the same, if not the same, specify it yourself;
After the installation, the Eaccelerator.so module is located in the/usr/lib/php/extensions directory, your system if it is not the same as me, you should install where you yourself; # echo "/usr/lib/php/extensions" >/ Etc/ld.so.conf
# ldconfig NOTE: Update the dynamic link library address;
Modify the configuration file;
We first have to modify; php.ini, then restart Apache;
In the php.ini file, add;
zend_extension= "/usr/lib/php/extensions/eaccelerator.so" NOTE: The specific location 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: wherein, the specific location of the module must be correct, to your system, the size of the shared memory can be adjusted, feel 16M or can, according to the situation of the server, you tune it yourself.
The cache directory can be specified by itself, we specify here is the Eaccelerator directory on the/home directory, if not, create one yourself; permissions are 0777;
The above configuration is the way to compile eaccelerator as a Zend extension module. If your PHP is compiled with the installation mode, change the zend_extension to Zend_extension_ts.
If you are using 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"
is not effective, you want to view the/home/eaccelerator directory, when the Apache server starts up, you casually point to a few pages, if in this directory, the file appears. That's the effect. If you don't have any documents, you need to find out why ... These two configuration files are not working. You need to modify it yourself according to the situation.
# Mkdir/home/eaccelerator
# chmod 777/home/eaccelerator Note: Create a cache directory pool with permissions of 777
?
?
Eaccelerator.shm_size= "32"
The amount of shared memory that Eaccelerator can use (in megabytes). "0" refers to the default value of the operating system. The default value is "0". can be adjusted according to the actual situation of the server, 16,32,64,128 are OK.
Eaccelerator.cache_dir= "/home/php/tmp"
This directory is used for disk caching. Eaccelerator stores pre-compiled code, process data, content, and user-defined content here. The same data can also be stored in shared memory (which can improve access speed). The default setting is "/tmp/eaccelerator".
eaccelerator.enable= "1"
Turn eaccelerator on or off. "1" is on, "0" is off. The default value is "1".
Eaccelerator.optimizer= "1"
Power on or off the internal optimizer to increase code execution speed. "1" is on, "0" is off. The default value is "1".
Eaccelerator.check_mtime= "1"
Open or close the PHP file modification check. "1" means open, "0" means close. If you recompile the PHP file after you modify it, you should set it to "1". The default value is "1".
eaccelerator.debug= "0"
Turn debug logging on or off. "1" is on, "0" is off. The default value is "0". Records are written to the log when the cache is hit.
Eaccelerator.filter= ""
Determine which PHP files must be cached. You can specify cached and non-cached file types (such as "*.php *.phtml", etc.)
If the argument starts with "!", the file that matches these parameters is ignored by the cache. The default value is "", that is, all PHP files will be cached.
eaccelerator.shm_max= "0"
When you use the "eaccelerator_put ()" function, it is forbidden to store too large files in shared memory. This parameter specifies the maximum value that is allowed to be stored in bytes (10240, 10K, 1M). "0" is not limited. The default value is "0".
Eaccelerator.shm_ttl= "0"
When Eaccelerator gets the shared memory size of a new script fails, it removes all script caches that were not accessed in the last "Shm_ttl" seconds from shared memory. The default value is "0", which is: Do not delete any cache files from the share inner spring.
eaccelerator.shm_prune_period= "0"
When Eaccelerator gets the shared memory size of a new script fails, he tries to remove the cache script that is older than "shm_prune_period" seconds from shared memory. The default value is "0", which is: Do not delete any cache files from the share inner spring.
eaccelerator.shm_only= "0"
Allows or disables the caching of compiled scripts on disk. This option is not valid for session data and content caching. The default value is "0", which is: Use disk and shared memory for caching.
eaccelerator.compress= "1"
Allows or disables the compression of the content cache. The default value is "1", which is: Allow compression.
Eaccelerator.compress_level= "9"
Specifies the compression level of the content cache. The default value is "9", which is the highest level.
Eaccelerator.keys = "Disk_only"
Eaccelerator.session = "Disk_only"
Eaccelerator.content = "Disk_only"
Set where the content cache is stored, which can be set to:
Shm_and_disk in shared cache and hard disk (default value)
SHM shared memory By default, if the shared memory is full or the size exceeds the value of "Eaccelerator.shm_max", it will be saved to the hard disk
shm_only only stored in shared memory
Disk_only is only stored on the hard drive
None does not cache data
Eaccelerator.allowed_admin_path = "/var/www/html/web/eaccelerator"
This is the address of the control Panel.
There is a control.php in the installation package, you copy it to any directory on the website, you can use it to view and manage it, this must be specified, otherwise, when viewing the contents of the cache error
Finally, take a look at my eaccelerator settings
; Eaccelerator
[Eaccelerator]
zend_extension= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
Eaccelerator.shm_size= "128"
Eaccelerator.cache_dir= "/tmp/eaccelerator"
eaccelerator.enable= "1"
Eaccelerator.optimizer= "1"
Eaccelerator.check_mtime= "1"
eaccelerator.debug= "0"
Eaccelerator.filter= ""
eaccelerator.shm_max= "0"
Eaccelerator.shm_ttl= "3600"
eaccelerator.shm_prune_period= "3600"
eaccelerator.shm_only= "0"
eaccelerator.compress= "1"
Eaccelerator.compress_level= "9"
Eaccelerator.keys = "Disk_only"
Eaccelerator.sessions = "Disk_only"
Eaccelerator.content = "Disk_only"
Eaccelerator.allowed_admin_path = "/var/www/html/web/eaccelerator"
Besides, the installation of Eaccelerator
# wget HTTP://BART.EACCELERATOR.NET/SOURCE/0.9.6/EACCELERATOR-0.9.6.TAR.BZ2
# TAR-JXVF EACCELERATOR-0.9.6.TAR.BZ2
# CD eaccelerator-0.9.6
#/usr/local/php/bin/phpize
#./configure--enable-eaccelerator=shared--with-php-config=/usr/local/php/bin/php-config
# Make && make install
-------------------------------------
Open_basedir One of the workarounds that cannot be accessed after Setup
Warning:Unknown:open_basedir restriction in effect. File () is not within the allowed path (s): (.:/ tmp/) in Unknown on line 0
Fatal Error:can ' t load/xx/index.php, open_basedir restriction. In Unknown on line 0
There have been many times such a problem, feeling all start-up, always feel with the system and PHP, today appeared again, want to think it is not strange, after starting to recompile PHP, PHP extensions are not compiled, found that the setting Open_basedir, but no error ^ ^^?? ,?? From this information feel that some can be used, the expansion of their own plans to install, restart Apache, but found that the error occurred, The php.ini set in the extension of a one-off, start troubleshooting, after the Eaccelerator comment off, restart Apache did not appear error, location problems appear eaccelerator, in Google, found Eaccelerator 0.9.6 after the version with some changes in the past, the Open_basedir to limit, then we have to remove the restrictions on the line
Download Eaccelerator 0.9.6 do not install, after unpacking to find eaccelerator.c this file, open line 1156th, such as:
if (PG (open_basedir) && php_check_open_basedir (realname tsrmls_cc)) {
Modified to:
if (PG (open_basedir) && php_check_open_basedir (File_handle->filename tsrmls_cc)) {
After the changes are compiled, it's OK.