ubuntu php 加速器 APC安装 整理

转载自:http://hi.baidu.com/flyerzsk/item/da87c21387bd030db98a1ab1


安裝需要的 PHP 套件
sudo apt-get install php-pear php5-dev

安装Perl套件
sudo pecl install uploadprogress

下面两种方法安装APC:

一:
直接 sudo apt-get install php-apc

二:下面

安装apc
sudo pecl install apc

修改php.ini
增加 extension=uploadprogress.so
extension=apc.so



最后
重启apache
sudo /etc/init.d/apache2 restart 
--------------------------------------------------------------------------------------------
下面另一种 转载
apt-get install apache2-prefork-dev
apt-get install php-apc
一般来说这样也就够了

设置缓存,在/etr/mysql/my.cnf的[mysqld]段中增加:
Cache query-cache-type = 1
query-cache-size = 16M

修改/etc/apache2/apache2.conf,我的VPS为128M内存,swap不到400M,下面是我的配置
将Timeout 改为20,如果性能好可以稍微大一些
KeepAlive改为on,MaxKeepAliveRequests为20
KeepAliveTimeout为2,如果网站上图片、js代码比较多可以稍大一些

<IfModule mpm_prefork_module>
StartServers          1//启动apache2以后运行的服务个数
MinSpareServers       1//最小空闲服务个数,如果网站人流量大可以调大
MaxSpareServers       2//最大空闲服务个数,资源紧张尽量调小
ServerLimit          10//最大服务进程数量,硬限制
MaxClients           10//最大服务进程数量,软限制
MaxRequestsPerChild   200//处理多少个请求后必须重启服务进程,php脚本小一些比较好
</IfModule>

/etc/init.d/apache2 restart重启apache服务

或者

APC, Alternate PHP Cache, is now the most maintained free/open source op-code cache, and is being used more and more as it emerges to be the most stable.

The instructions here detail how to get APC running on an Ubuntu server running Gutsy Gibbon 7.10.

First, we need the pecl command so we can download and install APC from the repositories.

Do to so, we execute the following command:

aptitude install php-pear

But, this will not run on its own, we need the following package for the phpize command:

aptitude install php5-dev

We also need the apxs command, which is installed via the following package:

aptitude install apache2-dev

Now we have all the software we need, so we install apc via the pecl command:

pecl install apc

APC, Alternate PHP Cache, is now the most maintained free/open source op-code cache, and is being used more and more as it emerges to be the most stable.

The instructions here detail how to get APC running on an Ubuntu server running Gutsy Gibbon 7.10.

First, we need the pecl command so we can download and install APC from the repositories.

Do to so, we execute the following command:
aptitude install php-pear

But, this will not run on its own, we need the following package for the phpize command:
aptitude install php5-dev

We also need the apxs command, which is installed via the following package:
aptitude install apache2-dev

Now we have all the software we need, so we install apc via the pecl command:
pecl install apc

Once that finishes, we need to enable apc in Apache’s configuration. the following command should do this for us.
echo "extension=apc.so" > /etc/php5/apache2/conf.d/apc.ini

Then we restart Apache:
/etc/init.d/apache2 restart

And we are all done. Watch for less execution time per page, and decreased memory usage per Apache process compared to what you had befor

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值