linux中DirectAdmin添加Xcache教程

來源:互聯網
上載者:User

XCache 是一個開源的 opcode 緩衝器/最佳化器, 這意味著他能夠提高您伺服器上的 PHP 效能。 他通過把編譯 PHP 後的資料緩衝到共用記憶體從而避免重複的編譯過程,能夠直接使用緩衝區已編譯的代碼從而提高速度.,通常能夠提高您的頁面產生速率 2 到5 倍,且還能降低伺服器負載。

一、下載並安裝

cd /usr/local/src/
wget http://xcache.lighttpd.net/pub/Releases/2.0.1/xcache-2.0.1.tar.gz
tar -zxvf xcache-2.0.1.tar.gz
cd xcache-2.0.1
export PHP_PREFIX="/usr/local"
$PHP_PREFIX/php5/bin/phpize
./configure --enable-xcache -with-php-config=$PHP_PREFIX/php5/bin/php-config
make && make install

二、安裝完畢,調用

修改PHP.INI【如DirectAdmin的SuPHP模式安裝的在/usr/local/etc/php5/cgi】
將以下內容加到ZEND上面:

[xcache-common]
zend_extension = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/xcache.so
[xcache.admin]
xcache.admin.user = "admin"
xcache.admin.pass = ""
; xcache.admin.pass = md5($your_password)
xcache.admin.enable_auth = On
[xcache]
xcache.cacher =               On
xcache.size  =               64M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =              3600
xcache.gc_interval =         300
xcache.var_size  =            0M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300
xcache.readonly_protection = Off
xcache.mmap_path =    "/dev/zero"

三、重啟APACHE

service httpd restart

有兩點注意事項,在這裡提及下。

第一點,就是我們修改php.ini的時候,一定要把XCache加入的內容放到Zend的上面;

第二點,我在PHP5.2.17版本上也測試過同樣的過程,跟PHP5.3.25不同的是,extension_dir目錄為

/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.