2011/03/24 21:20
文章作者:Enjoy 转载请注明原文链接。
照猫画虎写了个升级APC的脚本,在几台服务器上测试通过。主要需要修改一个参数,php_path,是PHP的安装路径。
另两个参数是soft_path软件下载的目录,apc_version是apc的版本号,目前3.1.6是最新稳定版。
安装完后,需要重启相应服务。
如果是apache+php,那么重启apache;
如果是nginx+php(fast-cgi),那么重启php-fpm。/usr/local/webserver/php/sbin/php-fpm restart
脚本update-apc.sh源码如下:
#!/bin/bash
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to upgrade"
exit 1
fi
clear
echo "========================================================================="
echo "Upgrade APC, Written by hx"
echo "========================================================================="
echo "For more information please visit http://www.9enjoy.com/"
echo "========================================================================="
soft_path=/root/soft
apc_version=3.1.6
php_path=/usr/local/webserver/php
cd $soft_path
wget http://pecl.php.net/get/APC-$apc_version.tgz
tar zxf APC-$apc_version.tgz
cd APC-$apc_version
${php_path}/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=${php_path}/bin/php-config
make;make install
echo "APC upgrade completed!"
echo "========================================================================="
echo "You have successfully upgrade APC to $apc_version"
echo "========================================================================="
echo "For more information please visit http://www.9enjoy.com/"
echo "========================================================================="
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to upgrade"
exit 1
fi
clear
echo "========================================================================="
echo "Upgrade APC, Written by hx"
echo "========================================================================="
echo "For more information please visit http://www.9enjoy.com/"
echo "========================================================================="
soft_path=/root/soft
apc_version=3.1.6
php_path=/usr/local/webserver/php
cd $soft_path
wget http://pecl.php.net/get/APC-$apc_version.tgz
tar zxf APC-$apc_version.tgz
cd APC-$apc_version
${php_path}/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=${php_path}/bin/php-config
make;make install
echo "APC upgrade completed!"
echo "========================================================================="
echo "You have successfully upgrade APC to $apc_version"
echo "========================================================================="
echo "For more information please visit http://www.9enjoy.com/"
echo "========================================================================="