一、opcache wget http://pecl.php.net/get/zendopcache-7.0.2.tgz tar xzf zendopcache-7.0.2.tgz cd zendopcache-7.0.2 /usr/local/php/bin/phpize (此处根据实际php安装路径) ./configure --with-php-config=/usr/local/php/bin/php-config make make install 如果显示Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/ 表示安装完成,下面要修改php的配置文件让它生效 接着呢,配置下php.ini,在最后加上: [opcache] zend_extension=opcache.so opcache.enable=1 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 二、xcache wget http://xcache.lighttpd.net/pub/Releases/3.1.0/xcache-3.1.0.tar.gz tar -zvxf xcache-3.1.0.tar.gz cd xcache-3.1.0 ./configure --prefix=/php的路径/lib/php/extensions \ --with-php-config=/php的路径/bin/php-config \ --enable-xcache make #编译 make install #安装 配置php.ini vim /etc/php.ini 在尾部添加如下内容: [xcache-common] extension = xcache.so [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "admin" xcache.admin.pass = "21232f297a57a5a743894a0e4a801fc3" [xcache] xcache.shm_scheme = "mmap" xcache.size = 128M xcache.count = 1 xcache.slots = 8K xcache.ttl = 0 xcache.gc_interval = 0 xcache.var_size = 4M xcache.var_count = 1 xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.var_namespace_mode = 0 xcache.var_namespace = "" xcache.readonly_protection = Off xcache.mmap_path = "/tmp/xcache" xcache.coredump_directory = "" xcache.coredump_type = 0 xcache.disable_on_crash = Off xcache.experimental = Off xcache.cacher = On xcache.stat = On xcache.optimizer = Off 保存重启php或httpd service php-fpm restart |