說明:
php安裝目錄:/usr/local/php
php.ini配置檔案路徑:/usr/local/php/etc/php.ini
Nginx安裝目錄:/usr/local/nginx
Nginx網站根目錄:/usr/local/nginx/html
1、安裝xcache
1
2
3
4
5
6
7
8
9
10
<code>tar</code> <code>zxvf xcache-3.2.0.</code><code>tar</code><code>.gz </code>
<code>cd</code> <code>xcache-3.2.0 </code>
<code>/usr/local/php/bin/phpize</code>
<code>.</code><code>/configure</code> <code>\</code>
<code>--</code><code>enable</code><code>-xcache\</code>
<code>--</code><code>enable</code><code>-xcache-coverager \</code>
<code>--</code><code>enable</code><code>-xcache-optimizer \</code>
<code>--with-php-config=</code><code>/usr/local/php/bin/php-config</code>
<code>make</code>
<code>make</code> <code>install</code>
安裝完成之後,出現下面的界面,記住以下路徑,後面會用到。
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ #xcache子產品路徑
2、建立xcache緩存檔案
<code>touch</code> <code>/tmp/xcache</code>
<code>chmod</code> <code>777 </code><code>/tmp/xcache</code>
3、建立xcache管理者密碼為123456
<code>echo</code> <code>-n </code><code>"123456"</code> <code>| md5sum</code>
#記住類似下面一行代碼(md5加密之後的密碼),後面會用到
e10adc3949ba59abbe56e057f20f883e
4、拷貝xcache背景管理程式到網站根目錄
<code>cp</code> <code>-r htdocs </code><code>/usr/local/nginx/html/xcache</code>
<code>chown</code> <code>www.www -R </code><code>/usr/local/nginx/html/xcache</code>
#設定xcache目錄和網站目錄權限相同
5、配置php支援xcache
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<code>vi</code> <code>/usr/local/php/etc/php</code><code>.ini </code><code>#編輯配置檔案,在最後一行添加以下内容</code>
<code>[xcache-common]</code>
<code>extension = xcache.so</code>
<code>[xcache.admin]</code>
<code>xcache.admin.enable_auth = On</code>
<code>xcache.admin.user = </code><code>"xcache"</code>
<code>xcache.admin.pass = </code><code>"e10adc3949ba59abbe56e057f20f883e"</code>
<code>[xcache]</code>
<code>xcache.shm_scheme =</code><code>"mmap"</code>
<code>xcache.size=60M</code>
<code>xcache.count =1</code>
<code>xcache.slots =8K</code>
<code>xcache.ttl=0</code>
<code>xcache.gc_interval =0</code>
<code>xcache.var_size=64M</code>
<code>xcache.var_count =1</code>
<code>xcache.var_slots =8K</code>
<code>xcache.var_ttl=0</code>
<code>xcache.var_maxttl=0</code>
<code>xcache.var_gc_interval =300</code>
<code>xcache.</code><code>test</code> <code>=Off</code>
<code>xcache.readonly_protection = On</code>
<code>xcache.mmap_path =</code><code>"/tmp/xcache"</code>
<code>xcache.coredump_directory =</code><code>""</code>
<code>xcache.cacher =On</code>
<code>xcache.stat=On</code>
<code>xcache.optimizer =Off</code>
<code>[xcache.coverager]</code>
<code>xcache.coverager =On</code>
<code>xcache.coveragedump_directory =</code><code>""</code>
6、測試
<code>service php-fpm restart </code>
<code>service nginx restart</code>
浏覽器打開網站根目錄下面的xcache
http://ip/xcache
輸入使用者名xcache 密碼123456
引用網址:http://www.osyunwei.com/archives/8918.html
本文轉自1321385590 51CTO部落格,原文連結:http://blog.51cto.com/linux10000/1725229,如需轉載請自行聯系原作者