Install and configure eaccelerator-0.9.5 acceleration PHP-5.2.1 [original]

Source: Internet
Author: User
Tags zts

[Author: Zhang banquet this article version: V1.1 last modified: 2007.03.02 reprint please indicate the source: http://blog.s135.com]

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:
<? PHP
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)

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.