首页 > 代码库 > 安装 eAccelerator
安装 eAccelerator
一、安装前提
(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.bz2yum install -y bzip2tar xf eaccelerator-0.9.6.1.tar.bz2cd eaccelerator-0.9.6.1/usr/local/php/bin/phpize./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-configmake && make installcd ..
三、配置 eAccelerator
mkdir -p /tmp/eacceleratorchown -R nginx.nginx /tmp/eacceleratorcd /usr/local/php/lib/cat >> /usr/local/php/lib/php.ini << EOF[eaccelerator]extension=eaccelerator.soeaccelerator.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 -vPHP 5.3.27 (cli) (built: May 5 2017 07:35:34)Copyright (c) 1997-2013 The PHP GroupZend 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 0drwxrwxrwx 18 root root 150 May 6 08:30 0drwxrwxrwx 18 root root 150 May 6 08:30 1drwxrwxrwx 18 root root 150 May 6 08:30 2drwxrwxrwx 18 root root 150 May 6 08:30 3drwxrwxrwx 18 root root 150 May 6 08:30 4drwxrwxrwx 18 root root 150 May 6 08:30 5drwxrwxrwx 18 root root 150 May 6 08:30 6drwxrwxrwx 18 root root 150 May 6 08:30 7drwxrwxrwx 18 root root 150 May 6 08:30 8drwxrwxrwx 18 root root 150 May 6 08:30 9drwxrwxrwx 18 root root 150 May 6 08:30 adrwxrwxrwx 18 root root 150 May 6 08:30 bdrwxrwxrwx 18 root root 150 May 6 08:30 cdrwxrwxrwx 18 root root 150 May 6 08:30 ddrwxrwxrwx 18 root root 150 May 6 08:30 edrwxrwxrwx 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/mountstmpfs /tmp/eaccelerator tmpfs rw,relatime,size=16384k 0 0
安装 eAccelerator
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。