Help us understand the problem. What is going on with this article?

【PHP】PHP7でAPCuを動かす

More than 3 years have passed since last update.

まずはじめに

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 ~]# 
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away