2010年1月25日月曜日

PHP アクセラレーターXcacheのインストール

早速インストール

[root@centos ~]# cd /usr/local/src
[root@centos src]# wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
[root@centos src]# tar xzvf xcache-1.3.0.tar.gz
[root@centos src]# cd xcache-1.3.0
[root@centos xcache-1.3.0]# phpize
[root@centos xcache-1.3.0]# ./configure --enable-xcache
[root@centos xcache-1.3.0]# make/usr/include/php/ext/date/lib/timelib_structs.h:24:28: error: timelib_config.h: No such file or directory/usr/local/src/xcache-1.3.0/xcache.c:2959: warning: initialization discards qualifiers from pointer target type
make: *** [xcache.lo] エラー 1

失敗!
googleで検索
Posted by moo XCache
on 15.08.2009 02:52
not a XCache problem. looks like it have problem searching .h file witin the same directory which compiler are u using? i assume it's gcc... hrm... open /usr/include/php/ext/date/lib/timelib_structs.h change #include timelib_config.hto #include "timelib_config.h" (or vice versa) or #include "/usr/include/php/ext/date/lib/timelib_config.h"
とあるので、timelib_structs.h を編集、保存
再度
[root@centos xcache-1.3.0]# make
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
[root@centos xcache-1.3.0]# make install
Installing shared extensions:     /usr/lib/php/modules/
成功!
次に設定ファイルの配置xcache.iniの内容を上記インストールディレクトリーに書き換え、パスワードを設定し保存、コピー
まず最初にコマンドラインからxcache.admin.passの値を求めてメモしておく。(******は各自適当に)
[root@centos xcache-1.3.0]# echo -n '******' | md5sum ←これをUser欄に挿入
XXXXXXXXXX ←これをパスワード欄に挿入
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
zend_extension = /usr/lib/php/modules/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so
;; or win32:
; extension = php_xcache.dll

[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "*******"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = "XXXXXXXXXXX"
[root@centos xcache-1.3.0]# cp xcache.ini /etc/php.d/
Webサーバーの再起動とXcacheの起動確認
[root@centos xcache-1.3.0]# /etc/rc.d/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]
[root@centos xcache-1.3.0]# php -v
PHP 5.1.6 (cli) (built: Jan 13 2010 17:13:05)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
はいOK!
続いて、ブラウザ管理の設定
adminディレクトリー内のファイルを/var/www/xcacheへコピー
[root@centos xcache-1.3.0]# mkdir /var/www/xcache
[root@centos xcache-1.3.0]# cd admin
[root@centos xcache-1.3.0]# cp * /var/www/xcache/
/var/www/xcache/をブラウザから見れるように設定する。適当にxcache.confファイルを作成し放り込む
で!設定ファイルが見れるようになりましたとさ・・・
後は後日!