WordPress高速化チューニングの第一歩! APC導入

CentOSでAPCをインストール(DTIのVPS)

サーバをDreamHost(米サーバ。糞重い)からDTIのVPS(国産VPS)に移転しました。
しかしWordPressの動作がそんなに速くならなかったので、PHP Acceleratorを何か入れることにしました。
VPSはルート権限があるのでこういうことも試せていいですね。

APCのインストール手順

ソースからコンパイルするのは面倒だし、PHPのバージョンと依存関係があったりするそうなので、peclでインストールすることにしました。

[root@dti-vps ]# pecl install APC
downloading APC-3.0.19.tgz ...
Starting to download APC-3.0.19.tgz (115,735 bytes)
.........................done: 115,735 bytes
47 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
Use apxs to set compile flags (if using APC with Apache)? [yes] : yes
building in /var/tmp/pear-build-root/APC-3.0.19
running: /tmp/tmpu4u0H7/APC-3.0.19/configure --with-apxs
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: `/tmp/tmpu4u0H7/APC-3.0.19/configure --with-apxs' failed

お。エラーです。PAYHが通ってない、と言われていますが、どうやらいくつかのモジュールが足りないようです。

# yum -y install gcc gcc-c++

もう一度試行。

[root@dti-vps ]# pecl install APC
(略)
Sorry, I was not able to successfully run APXS.  Possible reasons:
 
1.  Perl is not installed;
2.  Apache was not compiled with DSO support (--enable-module=so);
3.  'apxs' is not in your path.  Try to use --with-apxs=/path/to/apxs
The output of apxs follows
/tmp/tmpuAcvYD/APC-3.0.19/configure: line 3232: apxs: command not found
configure: error: Aborting
ERROR: `/tmp/tmpuAcvYD/APC-3.0.19/configure --with-apxs' failed

まだエラーが出ます。
http-develも必要のようです。

# yum install httpd-devel
[root@dti-vps ]# pecl install APC
略
 
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
 
running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-APC-3.0.19" install
Installing shared extensions:     /var/tmp/pear-build-root/install-APC-3.0.19/usr/lib/php/modules/
running: find "/var/tmp/pear-build-root/install-APC-3.0.19" -ls
241026596    4 drwxr-xr-x   3 root     root         4096  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19
241026657    4 drwxr-xr-x   3 root     root         4096  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19/usr
241026658    4 drwxr-xr-x   3 root     root         4096  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19/usr/lib
241026659    4 drwxr-xr-x   3 root     root         4096  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19/usr/lib/php
241026660    4 drwxr-xr-x   2 root     root         4096  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19/usr/lib/php/modules
241026656  408 -rwxr-xr-x   1 root     root       412650  929 09:41 /var/tmp/pear-build-root/install-APC-3.0.19/usr/lib/php/modules/apc.so
 
Build process completed successfully
Installing '/var/tmp/pear-build-root/install-APC-3.0.19//usr/lib/php/modules/apc.so'
install ok: channel://pecl.php.net/APC-3.0.19
You should add "extension=apc.so" to php.ini

成功しました。
php.iniを開いて、「extension=apc.so」の一行を追加して、ApacheをリスタートすればOKです。

[root@dti-vps ]# pecl install
[PHP]
extension=apc.so
;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
[root@dti-vps ]# service httpd restart

以上!

広告

About: dacelo


4 thoughts on “WordPress高速化チューニングの第一歩! APC導入”

  1. Pingback: dacelo

Leave a Reply

Your email address will not be published. Required fields are marked *