LoginSignup
10
8

More than 5 years have passed since last update.

【PHP】PHP7でAPCuを動かす

Posted at

まずはじめに

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の表示が出てくればOK

[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 ~]# 
10
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
8