Heim  >  Artikel  >  Backend-Entwicklung  >  Linux下PHP加速器APC的安装与配置笔记_PHP

Linux下PHP加速器APC的安装与配置笔记_PHP

WBOY
WBOYOriginal
2016-05-31 19:28:581184Durchsuche

当前我用的是APC-3.1.9 stable ,可以自己到 http://pecl.php.net/package/APC 下载最新版。

1、安装

 

代码如下:


wget http://pecl.php.net/get/APC-3.1.9.tgz
tar xzvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php/bin/php-config --prefix=/usr/local/apc
make && make install

 

注:安装编译后检查相应目录:

 

代码如下:


ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
-rwxr-xr-x 1 root root 659164 Apr 8 18:30 apc.so

 

安装成功!

2、配置/usr/local/php/etc/php.ini

 

代码如下:


vi /usr/local/php/etc/php.ini

 

shift+g到最末行,末尾加入

 

代码如下:


[apc]
extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/apc.so"
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 64
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 0
apc.write_lock = On

 

然后把APC目录下的apc.php复制到可以访问的目录

 

代码如下:


cp /root/APC-3.1.9/apc.php /home/wwwroot/

 

3、重启 LNMPA

 

代码如下:


/root/lnmpa restart

 

4、附:Windows下安装apc方法

下载地址: http://kromann.info/php5_2-Release_TS/php_apc.dll

 

代码如下:


extension = php_apc.dll

 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn