Install XCache PHP Accelerator in Linux by Compiling from Source安裝xcache的PHP加速器,在Linux的編制從源
XCache is an alternative yet fast and stable PHP accelerator and opcode cacher that is similar to the famous eAccelerator and APC (Alternative PHP Cache). xcache是另一種然而,快速而穩定的PHP加速器和操作碼cacher這是類似著名的eaccelerator和APC (可選PHP緩存) 。 XCache extension works by caching the compiled bytecode (opcode or intermediate code) form of PHP scripts to avoid the overhead to parse and compile PHP source code on every page request, and thus reduces server loads, boosts the performance of PHP scripts and increases the speed of PHP code from 2-10 times. xcache擴建工程通過高速緩存編譯字節(操作碼或中間代碼)形式的PHP腳本,以避免額外開銷解析和編譯PHP的源代碼在每個網頁上的要求,從而降低了服務器負載,提高性能的PHP腳本,並提高速度對PHP代碼從2-10倍。
XCache supports all of the latest PHP cvs branches such as PHP 4.3, PHP 4.4, PHP 5.1 and PHP 5.2 on Linux server including CentOS which common used on cPanel and Plesk based web hosting server, and ThreadSafe/Windows web server. xcache支持所有最新的PHP的CVS的分支,如PHP的4.3 , PHP的4.4 , PHP的5.1和PHP 5.2的Linux服務器上,包括centos共同使用的的cPanel和plesk基於網絡託管服務器,多線程/在Windows Web服務器。 XCache overcomes a lot of problems that exist on opcachers or accelerators such as unable to work with new PHP versions. xcache克服了很多存在的問題,就opcachers或加速器,如無法工作與新的PHP版本。 Beside, XCache also been旁邊,也被xcache benchmarked to be faster基準,以更快 than other opcode cachers.比其他操作碼cachers 。
This is a simple tutorial and guide on how to install XCache PHP cacher by manually compiling from source code package.這是一個簡單的補習和指導如何安裝xcache的PHP cacher通過手動編制從源代碼包。 If you’re using Wordpress or using XCache to speed up and improve Wordpress blog performance, you should first ensure that PHP is upgraded to latest version (PHP 5.2.1), as PHP 4 may cause some instability issue such as unable to post comment, partial page loading and etc. Anyway, PHP5 is always recommended if possible.如果您使用的WordPress或使用xcache加快和完善WordPress所博客的表現,您應該先確保PHP是升級到最新版本( PHP在5.2.1 ) , PHP 4中可能會造成一些不穩定的問題,如無法張貼評論,局部頁面加載等,無論如何, php5始終是建議,如果可能的。 And as with all PHP accelerator, XCache won’t work with PHP suEXEC turns on.作為與所有PHP加速器, xcache將不會工作,用PHP suexec輪流上。 PHP suEXEC must be disabled for XCache to work properly. PHP的suexec必須停用xcache才能正常工作。
Currently, XCache maintains 2 branches, ie version 1.0.3 and version 1.2.0.目前, xcache保持二科,即1.0.3版和1.2.0版。 Both version is now stable release, with version 1.0.x recommended for PHP 4.3.x and 4.4.x, and version 1.2.x recommended for most version of PHP including 5.1.x and 5.2.x, except PHP 5.0.x series.這兩個版本,現在是穩定的釋放,與1.0.x版本建議,對於PHP 4.3.x和4.4.x版本,版本1.2.x建議大多數的PHP版本中包括5.1.x和5.2.x ,除了PHP的5.0.x系列。 If you’re using PHP4, try both version of XCache to pick the one most suitable for your application.如果您使用php4 ,請嘗試都版本的xcache挑選一個最適合您的申請。 To check which version of PHP you’re usinng, issue command php -v or setup a PHP file with the following content, then call the file from web browser:檢查哪一個版本的PHP您usinng ,問題命令的PHP - V或設置一個PHP文件與以下內容,然後調用文件從Web瀏覽器:
<?php < ? PHP的
phpinfo(); phpinfo ( ) ;
?> ? >
- Change to user local source directory such as /usr/local/src by using following command:改變用戶本地源目錄中,如/ usr / local /下鋼骨混凝土用以下命令:
cd /usr/local/src裁談會在/ usr / local /鋼骨混凝土
- Retrieve and download the source package of the version of XCache you choose to install.檢索和下載源碼包的版本xcache您選擇安裝。
wget http://210.51.190.228/pub/XCache/Releases/xcache-1.0.3.tar.gz (for XCache 1.0.3) wget http://210.51.190.228/pub/xcache/releases/xcache-1.0.3.tar.gz ( xcache 1.0.3 )
or或
wget http://210.51.190.228/pub/XCache/Releases/xcache-1.2.0.tar.gz (for XCache 1.2.0) wget http://210.51.190.228/pub/xcache/releases/xcache-1.2.0.tar.gz ( xcache 1.2.0 )
- Untar, unzip, unpack or extract the archive with one of the following commands: untar ,解壓縮,解壓或提取物館與下列命令之一:
tar -zxf xcache-*.tar.gz焦油zxf xcache - *. tar.gz
gzip -dc xcache-*.tar.gz | tar -x gzip -直流xcache - *. tar.gz |焦油- X的 - Go into the xcache directory with source content:進入xcache目錄與源內容:
cd xcache裁談會xcache
- Trigger PHP building environment:觸發PHP的建築環境:
phpize
- Optional but recommended practice is to build XCache outside of source directory:可選,但建議的做法,是要建立xcache以外的源目錄:
mkdir ../xcache-build mkdir .. / xcache -建設
cd ../xcache-build裁談會.. / xcache -建設 - Run the configure with the option that you want, the basic is as below which will enable the XCache by default:運行配置與您想要的選項,基本是下面這將使xcache默認情況下:
../xcache/configure –enable-xcache .. / xcache /配置啟用- xcache
You can list out all available options by using ../xcache/configure –help command, which will display the following:您可以列出所有可供選擇使用.. / xcache /配置幫助命令,該命令將顯示以下內容:
–enable-xcache Include XCACHE support. -讓- xcache包括xcache支持。
–enable-xcache-optimizer XCACHE: (N/A) -讓- xcache -優化xcache : ( /一)
–enable-xcache-coverager XCACHE: Enable code coverage dumper -讓- xcache - coverager xcache :使代碼覆蓋泥頭
–enable-xcache-assembler XCACHE: (N/A) -讓- xcache -彙編xcache : ( /一)
–enable-xcache-disassembler XCACHE: Enable opcode to php variable dumper -讓- xcache - disassembler xcache :使操作碼,以PHP變量翻車
–enable-xcache-encoder XCACHE: (N/A) -讓- xcache編碼xcache : ( /一)
–enable-xcache-decoder XCACHE: (N/A) -讓- xcache編解碼器xcache : ( /一)
–enable-xcache-test XCACHE: Enable self test - FOR DEVELOPERS ONLY!! -讓- xcache試驗xcache :啟用自檢-開發商只! - Compile the source with following command:編譯源與以下命令:
make製造
Ensure that no error occurred.確保不發生錯誤。
- If you haven’t already using root account, su to root user.如果您尚未使用root帳號,蘇,以root用戶。
- Install XCache binary with the following command:安裝xcache二進制與以下命令:
make install使安裝
Ensure that no error occurred, and note down the extension installation path of the xcache.so.確保不發生錯誤,並記下延長安裝路徑的xcache.so 。
- Next, XCache need to be configured and enabled in PHP.INI file.接下來, xcache必須配置並啟用在php.ini文件。 Locate the correct location of php.ini configuration file by using找到正確的位置php.ini配置文件中使用 phpinfo() phpinfo ( ) function (see sample listed above to check version of PHP).功能(見樣本,上面列出的檢查版的PHP ) 。 In web hosting environment, normally it’s located in /etc or /usr/local/lib.在Web託管環境,通常它位於在/ etc或/ usr / local / lib目錄中。 If the install of PHP parses the /etc/php.d/ folder, then simply create a file in that folder named “xcache.ini” or copy over the sample xcache.ini came with source package.如果安裝的PHP解析的/ etc / php.d /文件夾,然後簡單地創建一個文件在該文件夾命名為“ xcache.ini ”或複製的樣本xcache.ini來與源碼包。
Change back to xcache source unpack directory, and run the following command with root user:改變回xcache來源解壓目錄,並運行以下命令與root用戶:
cat xcache.ini >> /etc/php.ini貓xcache.ini > >的/ etc / php.ini中
$EDITOR /etc/php.ini元編輯器的/ etc / php.ini中Note: change to the path of php.ini accordingly注意:改變路徑在php.ini因此
This will append the default XCache configuration to the end of php.ini.這將附加的默認xcache配置到去年底, php.ini的影響。 Alternatively, you can copy and paste the following text into the php.ini file yourself too:另外,您也可以複製並粘貼以下文本到php.ini文件自己太:
[xcache-common][ xcache -共同]
;; install as zend extension (recommended); ;安裝Zend擴展(推薦)
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-xxx/xcache.sozend_extension = / usr / local /下的lib / PHP中/擴展/無-調試-非特稿-三十/ xcache.so
;; install as zend extension with thread-safe; ;安裝Zend擴展與線程安全
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so; zend_extension_ts = / usr / local /下的lib / PHP中/擴展/非調試-特稿-三十/ xcache.so
;; install as PHP extension (extension_dir must be set to the full path to xcache.so); ;安裝作為PHP擴展( extension_dir必須設置的完整路徑xcache.so )
; extension = xcache.so;擴展= xcache.so[xcache.admin] [ xcache.admin ]
xcache.admin.user = “admin” xcache.admin.user = “管理員”
xcache.admin.pass = md5($your_password) xcache.admin.pass =的MD5 ( $ your_password )[xcache] [ xcache ]
xcache.shm_scheme = “mmap” xcache.shm_scheme = “ mmap ”
xcache.size = 16M xcache.size =一六米
xcache.count = 1 xcache.count = 1
xcache.slots = 8K xcache.slots = 8K型
xcache.ttl = 0 xcache.ttl = 0
xcache.gc_interval = 0 xcache.gc_interval = 0xcache.var_size = 0M xcache.var_size = 0米
xcache.var_count = 1 xcache.var_count = 1
xcache.var_slots = 8K xcache.var_slots = 8K型
xcache.var_ttl = 0 xcache.var_ttl = 0
xcache.var_maxttl = 0 xcache.var_maxttl = 0
xcache.var_gc_interval = 300 xcache.var_gc_interval = 300xcache.test = Off xcache.test =小康
xcache.readonly_protection = Off xcache.readonly_protection =小康
xcache.mmap_path = “/dev/zero” xcache.mmap_path = “ /開發/零”
xcache.coredump_directory = “” xcache.coredump_directory = “ ”
xcache.cacher = On xcache.cacher =對
xcache.stat = On xcache.stat =對
xcache.optimizer = Off xcache.optimizer =小康[xcache.coverager] [ xcache.coverager ]
xcache.coverager = Off xcache.coverager =小康
xcache.coveragedump_directory = “” xcache.coveragedump_directory = “ ” - You can configure XCache to your preference.您可以設定xcache您的喜好。 One setting that must be changed is under the [xcache-common], where you must specify the correct installation path of the XCache extension module. 1設置必須改變,是根據[ xcache -共同] ,在這裡您必須指定正確的安裝路徑的xcache擴展模塊。 You can also opt to run XCache as PHP extension instead of extension for Zend module.您也可以選擇運行xcache作為PHP的擴展,而是擴展的Zend模塊。 In this case, comment and uncomment the line accordingly.在這種情況下,評論和註釋線。 Other important options include “xcache.size” which specify amount the memory allocated to XCache, “xcache.count” to take advantage of multi-core processors or multiple processors.其他重要的選項包括“ xcache.size ”指定金額的內存分配給xcache , “ xcache.count ” ,以利用多核心處理器或多個處理器。 And if you plan to use XCache web administration interface, input the “xcache.admin.user” and md5 checksum value of “xcache.admin.pass”.如果您打算使用xcache Web管理介面,輸入“ xcache.admin.user ”和MD5校驗和價值“ xcache.admin.pass ” 。 Try嘗試 MD5 tools MD5的工具 to generate the correct value, or use the following command to generate the MD5 for your password:以產生正確的值,或使用下列命令產生的MD5為您的密碼:
echo -n “password” | md5sum迴聲- N的“密碼” | md5sum
Note: Explanation and definition of all XCache INI settings can be found注:解釋和定義,所有xcache的INI設置可以找到 here這裡 . 。
- Restart the Apache httpd web server.重新啟動的Apache的httpd網頁伺服器。 The following commands should work:下面的命令應該工作:
/etc/init.d/apache* restart / etc / init.d /的阿帕奇*重新啟動
or或
/etc/init.d/httpd* restart / etc / init.d /的的httpd *重新啟動
- Ensure the XCache is running by calling PHP file with phpinfo() (see sample above).確保xcache運行致電PHP文件與phpinfo ( ) (見上述範例) 。 You should see a new XCache Support block with opcode cache enabled.您應該會看到一個新的xcache支持座與操作碼緩存啟用。
- If you wish to set up XCache administration page, configure an alias in httpd.conf of Apache to point to the admin subdirectory within XCache.如果你想成立xcache政府網頁上,配置別名在httpd.conf的Apache ,以點到管理的子目錄內xcache 。 To do so, add the following line to httpd.conf (assuming your xcache source is extracted at /usr/local/src/, and you want to access admin page from /xcache-admin/ URL):這樣做,添加以下行httpd.conf中(假設您的xcache來源是提取在/ usr / local /下鋼骨混凝土/ ,您要訪問的政府當局頁從/ xcache -政府當局/網址) :
Alias /xcache-admin/ /usr/local/src/xcache/admin/別名/ xcache管理員/ / usr / local /下鋼骨混凝土/ xcache /管理/
Then restart Apache web server.然後重新啟動Apache Web服務器。 For lighttpd, add the following line instead:為lighttpd ,添加以下行,而是:
alias.url += (”/xcache-admin/” => “/usr/share/xcache/admin/”) alias.url + = ( “ / xcache -政府當局/ ” = > “在/ usr / share / xcache /管理/ ” )
Alternatively, you can also copy the whole “admin” directory from the “xcache” source folder to web document-root or sub-directory of your domain which is web accessible.另外,您也可以複製整個是“ admin ”目錄“ xcache ”源文件夾,以網頁文件的根或分目錄您的域名是網絡訪問的。 However, this method is not recommended as you may forget to update the admin page when XCache package is updated.不過,這種方法是不推薦您可能忘記,更新管理網頁時, xcache包更新。
Note: Ensure that注:確保 open_basedir protection和open_basedir保護 , if enabled, is excluded for the directory contains admin-page. ,如果啟用此功能,是排除為目錄包含了政府當局頁。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- Proper Way to Generate MD5 Hash for XCache Administration Password with md5sum or PHP正確的做法產生MD5哈希為xcache政府密碼與md5sum或php
- Run WordPress at Top Fast Speed by Putting Objects and Variables into XCache or eAccelerator Cache Memory (Plugin)運行的WordPress在頂端較快的速度把物體和變數納入xcache或eaccelerator快取記憶體(插件)
- Running Google Earth on Suse Linux with VMware Google地球運行在SuSE Linux上使用VMware
- Cheapest Linux Box Ever最便宜的Linux的方塊以往任何時候都
- Get Ready for Linux Genuine Advantage (LGA) - with Source and Crack準備Linux的真正優勢(飯店) -與來源和打擊
- Novell SUSE Linux Enterprise Server 10 Reviews Novell公司的SUSE Linux Enterprise Server 10評語
- Enable Gzip Compress on Wordpress with WP-Cache 2.x啟用gzip壓縮就在WordPress與可濕性粉劑緩存為2.x
- How to Open and View or Extract CHM (Compiled HTML) Files in Linux如何打開並查看或提取資料交換所機制(已編譯的HTML )文件在Linux
- Free Download Manager 2.5 Build 708 Released免費下載經理2.5建立708公佈
- Easily Set Up Web Server with XAMPP很容易成立的Web伺服器與xampp


















