前边已经测试过了opcache提升的性能,下边说说安装方法。 操作系统为centos opcache已经集成在了最新的的PHP5.5中,所以安装方法与PHP5.3、PHP5.4有所不同,下面会分别说明。 PHP5.5安装: 如果是第一次安装,可以在编译的时候加上enable-opcache参数 如果是
前边已经测试过了opcache提升的性能,下边说说安装方法。
操作系统为centos
opcache已经集成在了最新的的PHP5.5中,所以安装方法与PHP5.3、PHP5.4有所不同,下面会分别说明。
PHP5.5安装:
如果是第一次安装,可以在编译的时候加上–enable-opcache参数
如果是安装好的php,可以到源码的ext/opcahce目录下执行下列命令:
/opt/php55/bin/phpize ./configure --with-php-config=/opt/php55/bin/php-config make -j4 make install
phpize 和php-config的路径需要根据自己的实际情况来修改,上述命令是我的配置
PHP5.3 & PHP5.4 安装:
如果是php5.3、5.4则没有集成到源码里,我们可以下载后编译
wget http://pecl.php.net/get/zendopcache-7.0.2.tgz tar xzf zendopcache-7.0.2.tgz cd zendopcache-7.0.2 /opt/php53/bin/phpize ./configure --with-php-config=/opt/php53/bin/php-config make -j4 make install
安装完成后opcache.so会被安装到/opt/php53/lib/php/extensions/no-debug-non-zts-20090626目录下
我们需要在php.ini中添加下列配置
[Zend Opcache] Zend_extension= /opt/php53/lib/php/extensions/no-debug-non-zts-20090626/opcache.so Opcache.memory_consumption=64 Opcache.interned_strings_buffer=8 Opcache.max_accelerated_files=4000 Opcache.force_restart_timeout=180 Opcache.revalidate_freq=60 Opcache.fast_shutdown=1 Opcache.enable_cli=1
配置完成后可以通过php -i|grep opchche查看是否安装成功
成功后需要重启php-fpm或apche使之生效
原文地址:opcache安装, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version
