The performance of the LAMP server in Ubuntu is optimized. The installation of ZendOptimizer requires the PHP version to be 5.2. PHP5.3 of Ubuntu10.04 is not supported. For details, refer to PHP5.2. Download ZendOptimizer. Directly paste, refer to the version to change (this is 32-bit), or the home page to register to the http://downloads.zend.com/optimizer/3.3.9/ZendOpti
Performance Optimization of LAMP server in Ubuntu
Install Zend Optimizer
PHP version 5.2 is required. PHP5.3 of Ubuntu10.04 is not supported. See PHP5.2.
Download Zend Optimizer. Paste directly, refer to the version number to change (this is a 32-bit), or the home page can only be registered
Http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
Tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_compsudo mkdir/usr/local/zendsudo cp ZendOptimizer. so/usr/local/zend
Edit php. ini
Sudo gedit/etc/php5/apache2/php. ini
Note that punctuation marks must start with English.
[Zend Optimizer] zend_optimizer.optimization_level = 1 zend_extension = "/usr/local/zend/ZendOptimizer. so"
Restart apache2
Sudo/etc/init. d/apache2 restart
Or the above phpinfo file, you need to see the following information
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
Security Protection XCache
Sudo apt-get install php5-xcache
Root @ ubuntu:/home/qii # dpkg-l | grep xcachii php5-xcache 1.2.2-5 Fast, stable PHP opcode cacher
The xcache configuration file path is
/Etc/php5/conf. d/xcache. ini
Edit php. ini
Sudo gedit/etc/php5/apache2/php. ini
Add the xcache. ini content to php. ini. Restart apache2
Sudo/etc/init. d/apache2 restart
Check whether the installation is successful
Root @ ubuntu:/home/qii # php-vPHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10) Copyright (c) 1997-2009 The PHP GroupZend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
Install eAccelerator
Sudo apt-get install php5-dev
Download eAccelerator
Wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
Tar jxvf eaccelerator-0.9.6.1.tar.bz2
Cd eaccelerator-0.9.6.1
Phpizesudo./configure-enable-eaccelerator = sharedsudo make
Qii @ ubuntu :~ /Tmp/eaccelerator-0.9.6.1 $ sudo make installInstalling shared extensions:/usr/lib/php5/20060613 + lfs/
Modify the php. ini file and install it as the Zend extension. It is best to put it at the beginning and put it before [zend] To avoid inexplicable problems:
Sudo vi/etc/php5/apache2/php. ini
[Eaccelerator] zend_extension = "/usr/lib/php5/20060613 + lfs/eaccelerator. so "eaccelerator. shm_size = "16" 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 = "0" eaccelerator. shm_prune_period = "0" eaccelerator. shm_only = "0" eaccelerator. compress = "1" eaccelerator. compress_level = "9" eaccelerator. allowed_admin_path = "/var/www/control. php"
Create cache directory
Eaccelerator. cache_dir = "/var/cache/eaccelerator" the cache path is defined here.
The default value is/tmp/eaccelerator. This is very simple because anyone can write to this directory, but it is unwise because the directory is automatically cleared after restart. A better solution is/var/cache/eaccelerator. Create the Directory and make sure it is writable to the user of the eAccelerator (generally, this user is your web server operator, and may be www-data ). Use the default value to continue:
Mkdir/tmp/eaccelerator
Chmod 777/tmp/eaccelerator
Change to/var/cache/eaccelerator.
Eaccelerator. cache_dir = "/var/cache/eaccelerator"
Sudo mkdir/var/cache/eacceleratorsudo chown root: www-data/var/cache/eacceleratorsudo chmod u = rwx, g = rwx, o =/var/cache/eaccelerator
Copy control file control. php to the website root directory
Sudo cp control. php/var/www/htdocs/
Modify $ user and $ pw of control. php. The default values are admin and eAccelerator.
Sudo vi/var/www/htdocs/control. php
Restart apache
Sudo/etc/init. d/apache2 restart
Open http: // localhost/control. ph
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2