说明:
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,如需转载请自行联系原作者