Assembling and configuring eaccelerator-0.9.5 acceleration PHP-5.2.1

Source: Internet
Author: User
Tags zts
Installation and configuration of eaccelerator-0.9.5 acceleration PHP-5.2.1 Operating system: Linux 1, installation of eaccelerator-0.9.5 (also support ZendOptimizer-3.2.2) 1, first install ZendOptimizer-3.2 installation and configuration of eaccelerator-0.9.5 acceleration PHP-5.2.1

Operating system: Linux
  
1. install eaccelerator-0.9.5 (support ZendOptimizer-3.2.2 at the same time)
  
1. first install ZendOptimizer-3.2.2
  
# Wget http://www.vista.ac.cn/linux/down/ZendOptimizer/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# Tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# Cd ZendOptimizer-3.2.2-linux-glibc21-i386
#./Install. sh
  
In Please specify the location for installing ZendOptimizer: Enter the ZendOptimizer installation path, such as/data/webserver/zend
In Confirm the location of your php. ini file: Enter the directory where the php. ini file is located, for example,/data/webserver/php/etc.
In Specify the full path to the Apache control utility (apachectl): the system prompts you to enter the absolute path of apachectl, such as/data/webserver/apache/bin/apachectl.
  
  
2. re-install eaccelerator-0.9.5 acceleration software
  
# Wget http://www.vista.ac.cn/linux/down/eaccelerator/eaccelerator-0.9.5.tar.bz2
# Tar jxvf eaccelerator-0.9.5.tar.bz2
# Cd eaccelerator-0.9.5
  
Specify the php path:
# Export PHP_PREFIX = "/data/webserver/php"
# $ PHP_PREFIX/bin/phpize
#./Configure -- enable-eaccelerator = shared -- with-php-config = $ PHP_PREFIX/bin/php-config
# Make
# Make install
  
The eaccelerator is installed in the php directory, and the path of eaccelerator. so is displayed, for example:
Installing shared extensions:/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/
Remember this path.
  
The eaccelerator can be installed as the PHP extension or zend extension. the following installation is the PHP extension.
  
If the/etc/php. d directory exists, copy eaccelerator. ini to this directory and modify the default value. If it does not exist, modify php. ini and add the following content before [zend] (Note: it must be placed before [zend ):
  
[Eaccelerator]
Extension = "/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator. so"
Eaccelerator. shm_size = "32"
Eaccelerator. cache_dir = "/data/cache/eaccelerator"
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"
  
Create cache Directory:
# Mkdir-p/data/cache/eaccelerator
# Chmod 0777/data/cache/eaccelerator
  
Restart Apache:
# Service httpd restart
  
  
3. check whether ZendOptimizer and eaccelerator have been installed successfully.
  
Create a phpinfo. php file with the following content:
   ? ? Phpinfo ();
?>
  
Place the file in the website directory and access it in the browser. if the following content appears, the installation is successful:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
? ? With eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
? ? With Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
? ? With Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies
  
  
  
II. detailed description of eaccelerator configuration (translated according to official English instructions)
  
Extension = "/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator. so"
  
Explanation: PHP extension eaccelerator. so path.
  
--------------------
  
Eaccelerator. shm_size = "32"
  
Explanation: the shared memory size (in MB) that eaccelerator can use ).
  
In Linux, the maximum memory usage of a single process is limited by the number (in bytes) set in/proc/sys/kernel/shmmax ), for example, the shmmax of CentOS 4.4 defaults to 33554432 bytes (33554432 bytes/1024/1024 = 32 MB ).
  
Temporarily change this value:
# Echo bytes>/proc/sys/kernel/shmmax
  
The value is automatically restored every time the system is restarted. If you want to change it permanently, you can modify the/etc/sysctl. conf file and set it:
Kernel. shmmax = number of bytes
  
--------------------
  
Eaccelerator. cache_dir = "/data/cache/eaccelerator"
  
Explanation: cache path. you can run the command mkdir-p/data/cache/eaccelerator to create the directory, and then run the command chmod 0777/data/cache/eaccelerator to set the directory permission to 0777.
  
--------------------
  
Eaccelerator. enable = "1"
  
Explanation: enable or disable the eaccelerator. "1" means to open, "0" means to close. The default value is "1 ".
  
--------------------
  
Eaccelerator. optimizer = "1"
  
Explanation: enabling or disabling code optimization can speed up code execution. "1" means to open, "0" means to close. The default value is "1 ".
  
--------------------
  
Eaccelerator. check_mtime = "1"
  
Explanation: when this option is enabled, the eaccelerator checks the php file modification time for each request to see if it has been modified. this takes a little time. if the php file has been modified, the eaccelerator recompiles and caches the php file. When this option is disabled, if the php file is modified, you must manually delete the eaccelerator cache to display the modified php file. "1" means to open, "0" means to close. The default value is "1 ".
  
--------------------
  
Eaccelerator. debug = "0"
  
Explanation: enable or disable debugging records. When enabled, the eaccelerator writes every request to a cached file into the log. Enabling this option is only helpful for debugging whether the eaccelerator has a BUG. "1" means to open, "0" means to close. The default value is "0 ".
  
--------------------
  
Eaccelerator. filter = ""
  
Explanation: determines which php files should be cached. You can specify a range (for example, "*. php *. phtml") to cache the specified file. If the range is! The specified file will not be cached. The default value is "", indicating that all php files are cached.
  
--------------------
  
Eaccelerator. shm_max = "0"
  
Explanation: A user can use functions such as eaccelerator_put to load the maximum data in the shared memory. The default value is "0", indicating no restriction. (In bytes)
  
--------------------
  
Eaccelerator. shm_ttl = "0"
  
Explanation: when there is not enough free shared memory to try to buffer a new script, files that have not been accessed before shm_ttl seconds will be deleted. The default value is "0", indicating that no old scripts are deleted from the shared memory. (Unit: Seconds)
  
--------------------
  
Eaccelerator. shm_prune_period = "0"
  
Explanation: when there is not enough free shared memory to buffer a new script, all old scripts will be deleted, provided that the attempt was executed before shm_prune_period seconds. The default value is "0", indicating that no old scripts are deleted from the shared memory. (Unit: Seconds)
  
--------------------
  
Eaccelerator. shm_only = "0"
  
Explanation: enable or disable caching compiled scripts on the disk. This parameter has no effect on session data and content cache. The default value is "0", indicating that disk and shared memory are used for caching.
  
--------------------
  
Eaccelerator. compress = "1"
  
Explanation: enable or disable cache content compression. "1" means to open, "0" means to close. The default value is "1 ".
  
--------------------
  
Eaccelerator. compress_level = "9"
  
Explanation: memory compression level. The default value is 9, indicating maximum compression.
  
  
References:
1. Installing from source (http://www.eaccelerator.net/wiki/InstallFromSource)
2. eAccelerator settings (http://www.eaccelerator.net/wiki/Settings)

[Repost the banquet blog with the above content]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.