lnmp php7 opcache,lnmp1.5下开启opcache的开启和关闭

服务器环境CentOS7.2 + lnmp1.5,由于安装的是PHP 7.1,根据各种测试情况来看,开启opcache会提升不少性能,那咱得上啊。

开启opcache:

cd lnmp1.5

./addons.sh

+-----------------------------------------------------------------------+

| Addons script for LNMP V1.4, Written by Licess |

+-----------------------------------------------------------------------+

| A tool to Install cache,optimizer,accelerator...addons for LNMP |

+-----------------------------------------------------------------------+

| For more information please visit https://lnmp.org |

+-----------------------------------------------------------------------+

##### cache / optimizer / accelerator #####

1: eAccelerator

2: XCache

3: Memcached

4: opcache

5: Redis

6: apcu

##### Image Processing #####

7: imageMagick

##### encryption/decryption utility for PHP #####

8: ionCube Loader

exit: Exit current script

#####################################################

Enter your choice (1, 2, 3, 4, 5, 6, 7, 8 or exit): 4

Install Opcache will auto uninstall eAccelerator if exists...

====== Installing zend opcache ======

Press any key to start...or Press Ctrl+c to cancel

然后你按任意键就安装好了,在此感谢lnmp脚本为我们带来的便利。

关闭opcache:

在调试的时候,会发现刚修改的php代码好像并没有生效,清空框架缓存啥的也没效果,但是稍微过一会儿就生效了,推测是opcache的效果导致,所以我们在上线前可以先关闭它。

先运行一下phpinfo(),搜索opcache看一下你的配置文件目录在哪,如下图:

4e07872bfd3223616d965339ffa980d6.png

这个配置文件默认配置概是这样的:

[Zend Opcache]

zend_extension="opcache.so"

opcache.memory_consumption=128

opcache.interned_strings_buffer=8

opcache.max_accelerated_files=4000

opcache.revalidate_freq=60

opcache.fast_shutdown=1

opcache.enable_cli=1

把这里面的每一行前面加上;来注释它,然后重启php-fpm和nginx即可。

lnmp1.5下开启opcache的开启和关闭

更多精彩,敬请关注本博微信公众号:hsu1943

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值