基於xcache的配置與使用詳解_PHP教程

來源:互聯網
上載者:User
一、安裝Xcache
複製代碼 代碼如下:
# wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
# tar zxvf xcache-1.3.0.tar.gz
# cd xcache-1.3.0
# /usr/local/php/bin/phpize
# ./configure --enable-xcache--enable-xcache-coverager --enable-xcache-optimizer--with-php-config=/usr/local/php/bin/php-config
# make && make install

註:
--enable-xcache 表示啟用Xcache支援;
--enable-xcache-coverager 表示包含用於測量加速器功效的附加特性;
--enable-xcache-optimizer表示啟用作業碼最佳化

安裝完畢後系統會提示xcache.so模組產生路徑,本次產生路徑為/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/,然後把xcache.so移動到/usr/local/php/include/php/ext目錄下。
二、組態管理Xcache
1、修改php設定檔
配置時我們可以參考xcache的配置模板xcache.ini,此檔案位於Xcache安裝程式中
# vi /usr/local/php/lib/php.ini
然後添加如下內容
複製代碼 代碼如下:
extension_dir=/usr/local/php/include/php/ext
[xcache-common]
extension = xcache.so

[xcache.admin]

xcache.admin.enable_auth = On
xcache.admin.user = "xcache"
xcache.admin.pass = ""

[xcache]
xcache.shm_scheme ="mmap"
xcache.size=60M
xcache.count =1
xcache.slots =8K
xcache.ttl=0
xcache.gc_interval =0
xcache.var_size=4M
xcache.var_count =1
xcache.var_slots =8K
xcache.var_ttl=0
xcache.var_maxttl=0
xcache.var_gc_interval =300
xcache.test =Off
xcache.readonly_protection = On
xcache.mmap_path ="/tmp/xcache"
xcache.coredump_directory =""
xcache.cacher =On
xcache.stat=On
xcache.optimizer =Off

[xcache.coverager]
xcache.coverager =On
xcache.coveragedump_directory =""

2、產生Xcache快取檔案
# touch /tmp/xcache
# chmod 777 /tmp/xcache

3、產生Xcache管理員的秘密(MD5密文)
# echo -n "123456" | md5sum
e10adc3949ba59abbe56e057f20f883e
然後將上述產生的MD5密文粘貼到php.ini檔案中xcache.admin.pass = ""選項,xcache.admin.pass= "e10adc3949ba59abbe56e057f20f883e"

4、拷貝Xcache管理程式到網站根目錄下
複製代碼 代碼如下:
# cp -a /tmp/xcache-1.3.0/admin/ /usr/local/nginx/html/

然後重新啟動PHP,然後訪問http://localhost/admin ,使用者名稱為xcache 密碼為123456;另外,還可以通過phpinfo來驗證PHP是否支援Xcache

http://www.bkjia.com/PHPjc/327637.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327637.htmlTechArticle一、安裝Xcache 複製代碼 代碼如下: # wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz # tar zxvf xcache-1.3.0.tar.gz # cd xcache-1.3.0 # /usr/local...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.