标签:注意 PFS nmp 加速 bug size div tmp blog
一、安装前提
(1) 安装好 LNMP 完整环境
(2) Nginx 能够解析 PHP
(3) 配置环境变量:echo ‘export LC_ALL=C‘ >> /etc/profile && source /etc/profile 2> /dev/null
(4) 安装 Perl 相关依赖:yum install -y perl-devel
(5) 注意:eAccelerator 只支持 PHP 5.4 以下版本
(6) 注意:eAccelerator 、XCache 、ZendOpcache 都是缓存加速器,安装时只安装其中一个,首选 XCache
二、安装 eAccelerator
cd /usr/local/src/ wget https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 yum install -y bzip2 tar xf eaccelerator-0.9.6.1.tar.bz2 cd eaccelerator-0.9.6.1 /usr/local/php/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config make && make install cd ..
三、配置 eAccelerator
mkdir -p /tmp/eaccelerator chown -R nginx.nginx /tmp/eaccelerator cd /usr/local/php/lib/ cat >> /usr/local/php/lib/php.ini << EOF [eaccelerator] extension=eaccelerator.so eaccelerator.shm_size="64" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.optimizer="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
pkill php-fpm
/usr/local/php/sbin/php-fpm
四、测试 eAccelerator
[root@localhost lib]# /usr/local/php/bin/php -v
PHP 5.3.27 (cli) (built: May 5 2017 07:35:34)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
[root@localhost lib]# ll /tmp/eaccelerator/ total 0 drwxrwxrwx 18 root root 150 May 6 08:30 0 drwxrwxrwx 18 root root 150 May 6 08:30 1 drwxrwxrwx 18 root root 150 May 6 08:30 2 drwxrwxrwx 18 root root 150 May 6 08:30 3 drwxrwxrwx 18 root root 150 May 6 08:30 4 drwxrwxrwx 18 root root 150 May 6 08:30 5 drwxrwxrwx 18 root root 150 May 6 08:30 6 drwxrwxrwx 18 root root 150 May 6 08:30 7 drwxrwxrwx 18 root root 150 May 6 08:30 8 drwxrwxrwx 18 root root 150 May 6 08:30 9 drwxrwxrwx 18 root root 150 May 6 08:30 a drwxrwxrwx 18 root root 150 May 6 08:30 b drwxrwxrwx 18 root root 150 May 6 08:30 c drwxrwxrwx 18 root root 150 May 6 08:30 d drwxrwxrwx 18 root root 150 May 6 08:30 e drwxrwxrwx 18 root root 150 May 6 08:30 f
访问 php.ini 查看是否有 eAcelerator 加速器:
使用 tmpfs 优化 eAccelerator 缓存目录:
[root@localhost lib]# mount -t tmpfs -o size=16m tmpfs /tmp/eaccelerator [root@localhost lib]# mount -a [root@localhost lib]# grep eacc /proc/mounts tmpfs /tmp/eaccelerator tmpfs rw,relatime,size=16384k 0 0
标签:注意 PFS nmp 加速 bug size div tmp blog
原文地址:http://www.cnblogs.com/pzk7788/p/6907747.html