使用PHP7来运行APCu

首先

你是怎样安装PHP7的?

首先,我参考了这个链接安装了PHP7。
http://qiita.com/qiita-kurara/items/7f4619c04e5fee212147

让pecl可用

[root@test-web ~]# yum install php70w-pear httpd-devel

使用pecl工具安装APCu

[root@test-web ~]# pecl install APCu

对php.ini进行编辑

安装APCu后,会显示以下消息。

configuration option "php_ini" is not set to php.ini location
You should add "extension=apcu.so" to php.ini
[root@test-web ~]#

在php.ini文件中添加”extension=apcu.so”。

[root@test-web ~]# vi /etc/php.ini

附加内容:如何找到php.ini文件

在执行 php –ini 命令时,会读取位于最顶部的php.ini配置文件。
在此情况下,对应的是 ‘/etc/php.ini’。

[root@test-web ~]# php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/bz2.ini,
/etc/php.d/calendar.ini,
/etc/php.d/ctype.ini,
...
/etc/php.d/curl.ini,

[root@test-web ~]# 

用php -i进行确认

如果APCU的显示出现了,就可以了。

[root@test-web ~]# php -i | grep 'apc'
apcu
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp
[root@test-web ~]# 

重启httpd进程

[root@test-web ~]# /etc/init.d/httpd restart   
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@test-web ~]#