#!/bin/sh
##一键优化lamp之php
#安装eaccelerator缓存加速器
cd /home/lvnian/tools
tar jxf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6
/application/php/bin/phpize
./configure --enable-eaccelerato=shared --with-php-config=/application/php/bin/php-config
echo $?
make && make install
ls -l /application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
######编译安装xcache,xcache和eaccelerator都是加速模块,在生产中选择一个安装就可以了
cd /home/lvnian/tools
tar jxf xcache-1.3.2.tar.bz2
cd xcache-1.3.2
/application/php/bin/phpize
./configure --enable-xcache --with-php-config=/application/php/bin/php-config
echo $?
make && make install
ls -l /application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
###安装PDO_MYSQL扩展插件(可选择的)
cd /home/lvnian/tools
tar zxf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/application/php/bin/phpize
./configure --with-php-config=/application/php/bin/php-config \
--with-pdo-mysql=/application/mysql
echo $?
make && make install
ls -l /application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
###安装数据量Memcache缓存客户端软件(客户端软件)
cd /home/lvnian/tools
tar zxf memcache-2.2.5.tgz
cd memcache-2.2.5
/application/php/bin/phpize
./configure --with-php-config=/application/php/bin/php-config
make && make install
ls -l /application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
###安装图像软件
yum -y instals -l perl-CPAN
cd /home/lvnian/tools
tar zxf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make && make install
##安装扩展插件
cd /home/lvnian/tools
tar zxf imagick-2.3.0.tgz
cd imagick-2.3.0
/application/php/bin/phpize
./configure --with-php-config=/application/php/bin/php-config
make && make install
ls -l /application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
##配置php加速和缓存模块扩展
cp /application/php/lib/php.ini /application/php/lib/php.ini.ori
grep ' extension_dir = "./"' /application/php/lib/php.ini
sed -i 's#; extension_dir = "./"#extension_dir = "/application/php/lib/php/extensions/no-debug-zts-20090626/"#g' /application/php/lib/php.ini
grep 'extension_dir = ' /application/php/lib/php.ini
cat >> /application/php/lib/php.ini <<eof
extension = memcache.so
extension = pdo_mysql.so
extension = imagick.so
eof
##配置eaccelerator 缓存目录
grep User /application/apache/conf/httpd.conf
mkdir -p /tmp/eaccelerator
chown lvnian.lvnian /tmp/eaccelerator -R
##配置eaccelerator参数
cat >>/application/php/lib/php.ini<<eof
[eaccelerator]
extension=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"
eof
echo "------------php eaccelerator-------------"
/application/php/bin/php -v
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。