PHP 5.4.26 に EACCELERATOR V1.0-DEV をインストール

WEBページ(WordPress)を高速にするため、PHP 5.4.26に eAccelerator v1.0-dev モジュールをコンパイルで追加しました。2台構成なので各インストールしました。

>サービスストップ
# service php-fpm stop

>PHP5.4に対応しているソースをダウンロード
# wget https://lnamp-web-server.googlecode.com/files/eaccelerator-eaccelerator-42067ac.tar.gz

>解凍
# tar -xvf eaccelerator-eaccelerator-42067ac.tar.gz

>移動
# cd eaccelerator-eaccelerator-42067ac

>ビルドツールの確認
# phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

>which php-configのPath確認
# which php-config
/usr/bin/php-config

>eacceleratorのconfigure
# ./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config -with-eaccelerator-userid=nginx
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for a sed that does not truncate output… /bin/sed
checking for cc… cc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether cc accepts -g… yes
checking for cc option to accept ISO C89… none needed
checking how to run the C preprocessor… cc -E
checking for icc… no
checking for suncc… no
checking whether cc understands -c and -o together… yes
checking for system library directory… lib
checking if compiler supports -R… no
checking if compiler supports -Wl,-rpath,… yes
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking target system type… x86_64-unknown-linux-gnu
checking for PHP prefix… /usr
checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory… /usr/lib64/php/modules
checking for PHP installed headers prefix… /usr/include/php
checking if debug is enabled… no
checking if zts is enabled… no
checking for re2c… no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk… gawk
checking whether to enable eaccelerator support… yes, shared
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking for unistd.h… (cached) yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking sys/param.h usability… yes
checking sys/param.h presence… yes
checking for sys/param.h… yes
checking sched.h usability… yes
checking sched.h presence… yes
checking for sched.h… yes
checking mandatory system headers… yes
checking whether union semun is defined in sys/sem.h… no
checking for sysvipc shared memory support… yes
checking for mmap shared memory support… yes
checking for mmap on /dev/zero shared memory support… yes
checking for anonymous mmap shared memory support… yes
checking for posix mmap shared memory support… no
checking for best shared memory type… sysvipc
checking for spinlock semaphores support… yes
checking for pthread semaphores support… yes
checking for posix semaphores support… no
checking for sysvipc semaphores support… no
checking for fcntl semaphores support… yes
checking for flock semaphores support… yes
checking for best semaphores type… spinlock
checking for a sed that does not truncate output… (cached) /bin/sed
checking for fgrep… /bin/grep -F
checking for ld used by cc… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for BSD- or MS-compatible name lister (nm)… /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface… BSD nm
checking whether ln -s works… yes
checking the maximum length of command line arguments… 1966080
checking whether the shell understands some XSI constructs… yes
checking whether the shell understands “+=”… yes
checking for /usr/bin/ld option to reload object files… -r
checking for objdump… objdump
checking how to recognize dependent libraries… pass_all
checking for ar… ar
checking for strip… strip
checking for ranlib… ranlib
checking command to parse /usr/bin/nm -B output from cc object… ok
checking for dlfcn.h… yes
checking for objdir… .libs
checking if cc supports -fno-rtti -fno-exceptions… no
checking for cc option to produce PIC… -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works… yes
checking if cc static flag -static works… no
checking if cc supports -c -o file.o… yes
checking if cc supports -c -o file.o… (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

>eacceleratorのmake
# make

・・・・省略・・・・

libtool: install: cp ./.libs/eaccelerator.so /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules/eaccelerator.so
libtool: install: cp ./.libs/eaccelerator.lai /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules/eaccelerator.la
libtool: finish: PATH=”/root/.rbenv/bin:/root/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin” ldconfig -n /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules
———————————————————————-
Libraries have been installed in:
/usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking
– use the `-Wl,-rpath -Wl,LIBDIR’ linker flag
– have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-

Build complete.
Don’t forget to run ‘make test’.

>eacceleratorのmake test
# make test

Build complete.
Don’t forget to run ‘make test’.
=====================================================================
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.4.26
ZEND_VERSION: 2.4.0
PHP_OS : Linux – Linux websample.jp 2.6.32-431.5.1.el6.x86_64 #1 SMP Wed Feb 12 00:41:43 UTC 2014 x86_64
INI actual : /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/tmp-php.ini
More .INIs :
CWD : /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2014-03-10 19:13:05
=====================================================================
No tests were run.

>eacceleratorのmake install
# make install
Installing shared extensions: /usr/lib64/php/modules/

+——————————————————-+
| !!! Attention !!! |
| |
| For disk cache users (using eaccelerator.shm_only=0): |
| |
| Please remember to empty your eAccelerator disk cache |
| when upgrading, otherwise things will break! |
+——————————————————-+
>/etc/php.ini の最後に以下を追記
[eaccelerator]
zend_extension=”/usr/lib64/php/modules/eaccelerator.so”
eaccelerator.shm_size = “128″
eaccelerator.cache_dir = “/var/cache/php-eaccelerator”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
eaccelerator.check_mtime = “1″
eaccelerator.debug = “0″
eaccelerator.filter = “”
eaccelerator.shm_max = “0″
eaccelerator.shm_ttl = “0″
eaccelerator.shm_prune_period = “0″
eaccelerator.shm_only = “0″
eaccelerator.compress = “1″
eaccelerator.compress_level = “9″
eaccelerator.keys = “shm_and_disk”
eaccelerator.sessions = “shm_and_disk”
eaccelerator.content = “shm_and_disk”

>php-fpm の起動
# service php-fpm start

※確認1
# php -v
PHP 5.4.26 (cli) (built: Mar 5 2014 16:04:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator

※確認2
# php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
eAccelerator   ←←←←←←←←←←
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
recode
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
eAccelerator

※ギャラリー(写真)ページが遅かったが、1度キャシュされた後は、体感で感じるほど高速になりました。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>