コンパイルしたファイルをCacheして、phpの動作を速くする
APC(Alternative PHP Cache)。
IISでコンパイル済みASP、ASPX等をCacheするのと同じような設定という認識。

http://php.net/manual/ja/book.apc.php

[root@ip-xxxxxxxxx ec2-user]# yum install php-pear php-devel http-devel
Loaded plugins: fastestmirror, priorities, security, update-motd
Loading mirror speeds from cached hostfile
* amzn-main: packages.ap-northeast-1.amazonaws.com
* amzn-updates: packages.ap-northeast-1.amazonaws.com
Setting up Install Process
No package http-devel available.
Resolving Dependencies
–> Running transaction check
—> Package php-devel.x86_64 0:5.3.10-1.18.amzn1 will be installed
–> Processing Dependency: autoconf for package: php-devel-5.3.10-1.18.amzn1.x86_64
–> Processing Dependency: automake for package: php-devel-5.3.10-1.18.amzn1.x86_64
—> Package php-pear.noarch 1:1.9.4-4.8.amzn1 will be installed
–> Running transaction check
—> Package autoconf.noarch 0:2.63-5.1.7.amzn1 will be installed
—> Package automake.noarch 0:1.11.1-2.9.amzn1 will be installed
–> Finished Dependency Resolution

その他、gcc,make,PHP dev,apache dev,pcre,apxs関係など
不足していたパッケージインストール。

[root@ip-xxxxxxxxx ec2-user]# pecl install APC
downloading APC-3.1.9.tgz …
Starting to download APC-3.1.9.tgz (155,540 bytes)
……………………………done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from…
config.m4:180: the top level
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, …): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from…
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from…
config.m4:180: the top level
Enable internal debugging in APC [no] :
Enable per request file info about files used from the APC cache [no] :
Enable spin locks (EXPERIMENTAL) [no] :
Enable memory protection (EXPERIMENTAL) [no] :
Enable pthread mutexes (default) [yes] :
Enable pthread read/write locks (EXPERIMENTAL) [no] :
building in /var/tmp/pear-build-rootBND1Ww/APC-3.1.9

…… 省略

Build process completed successfully
Installing ‘/usr/lib64/php/modules/apc.so’
Installing ‘/usr/include/php/ext/apc/apc_serializer.h’
install ok: channel://pecl.php.net/APC-3.1.9
configuration option “php_ini” is not set to php.ini location
You should add “extension=apc.so” to php.ini

[root@ip-xxxxxxxxx ec2-user]# echo “extension=apc.so” > /etc/php.d/apc.ini
[root@ip-xxxxxxxxx ec2-user]# pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
APC 3.1.9 stable
[root@ip-xxxxxxxxx ec2-user]#

[root@ip-xxxxxxxxx ec2-user]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@ip-xxxxxxxxx ec2-user]#

APCの状況確認用ページ 「httpでアクセス出来るところにコピー」
[root@ip-xxxxxxxxx ec2-user]# ls -l /usr/share/pear/apc.php
-rw-r–r– 1 root root 46148 Apr 7 09:17 /usr/share/pear/apc.php
[root@ip-xxxxxxxxx ec2-user]#

APC

APC

[ec2-user@ip-xxxxxxxxx ec2-user]$ php -i | grep apc
Additional .ini files parsed => /etc/php.d/apc.ini,
apc
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On
[ec2-user@ip-xxxxxxxxx ec2-user]$

Comments are closed.

Post Navigation