這篇文章主要為大家展示了“如何手動(dòng)為LiteSpeed安裝eAccelerator和XCache”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“如何手動(dòng)為LiteSpeed安裝eAccelerator和XCache”這篇文章吧。
為富陽等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及富陽網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站設(shè)計(jì)、做網(wǎng)站、富陽網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
其實(shí)LiteSpeed在編譯PHP的時(shí)候有這兩個(gè)組件可選,但為什么微魔要單獨(dú)手動(dòng)安裝呢?原因是官方的這兩個(gè)組件勾選后經(jīng)常出現(xiàn)無法解析等問題,這一問題和具體你使用的vps似乎無關(guān),而和官網(wǎng)鏈接的時(shí)常抽風(fēng)有關(guān),因此,為了避免卡在Compile PHP的第一步,可以暫時(shí)取消這兩個(gè)組件,像本文一樣,手動(dòng)安裝~
無論安裝哪一個(gè),請先確保/usr/local/lsws/lsphp5/lib/php.ini是否存在,若不存在,執(zhí)行如下命令
cp /usr/local/lsws/php/php.ini /usr/local/lsws/lsphp5/lib/
無論你選擇安裝哪一個(gè),最后都請?jiān)贚iteSpeed面板里Graceful Restart重啟生效~
安裝eAccelerator
1.安裝必要的依賴文件(很多時(shí)候這一步其實(shí)是多此一舉,但是為了避免出錯(cuò),還是做吧~)
本文我以Debian為例,至于CentOS,可以講文中apt-get換成yum,基本可以通用~
apt-get install autoconf automake libtool m42.安裝eAccelerator
可自行到官網(wǎng)查詢最新版的下載鏈接,替換下面的url(前往官網(wǎng)下載頁)
代碼如下:
cd ~
wget https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
/usr/local/lsws/lsphp5/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/lsws/lsphp5/bin/php-config
make
make install
如果你默認(rèn)在LiteSpeed里編譯的是PHP 5.4,進(jìn)行make的時(shí)候可能出現(xiàn)如下錯(cuò)誤,原因可能是新版對5.4的不兼容造成的。要么改裝XCache,要么就換PHP 5.3吧
代碼如下:
/home/package/eaccelerator-0.9.6.1/eaccelerator.c: In function ‘eaccelerator_restore’:
/home/package/eaccelerator-0.9.6.1/eaccelerator.c:878: warning: assignment discards qualifiers from pointer target type
/home/package/eaccelerator-0.9.6.1/eaccelerator.c: In function ‘eaccelerator_compile_file’:
/home/package/eaccelerator-0.9.6.1/eaccelerator.c:1317: error: ‘zend_class_entry’ has no member named ‘line_start’
/home/package/eaccelerator-0.9.6.1/eaccelerator.c: At top level:
/home/package/eaccelerator-0.9.6.1/eaccelerator.c:1913: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘eaccelerator_functions’
/home/package/eaccelerator-0.9.6.1/eaccelerator.c:1938: error: ‘eaccelerator_functions’ undeclared here (not in a function)
make: *** [eaccelerator.lo] Error
13.配置eAccelerator生效(這一部分在前面的文章里講過,這里不多說了~)
代碼如下:
mkdir /usr/local/eaccelerator_cache
chmod -R 777 /usr/local/eaccelerator_cache
vi /usr/local/lsws/lsphp5/lib/php.ini
在php.ini文件末尾加入如下字段
代碼如下:
[eaccelerator]
zend_extension="/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size="1"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "disk_only"
eaccelerator.sessions = "disk_only"
eaccelerator.content = "disk_only"
檢測php.ini文件是否正常
代碼如下:
/usr/local/lsws/lsphp5/bin/php -v
不出意外的話應(yīng)該不會(huì)報(bào)錯(cuò)~
安裝XCache
1.安裝Xcache(查看官網(wǎng)最新版本)
代碼如下:
cd ~
wget http://xcache.lighttpd.net/pub/Releases/3.0.0/xcache-3.0.0.tar.gz
tar zxvf xcache-3.0.0.tar.gz
cd xcache-3.0.0
/usr/local/lsws/lsphp5/bin/phpize
./configure --enable-xcache --with-php-config=/usr/local/lsws/lsphp5/bin/php-config
make
make install
make install后會(huì)給出一個(gè)目錄,記下來備用,根據(jù)litespeed的版本不同,似乎這個(gè)目錄名也不同~我的是/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20100525/
2.修改php.ini文件
代碼如下:
vi /usr/local/lsws/lsphp5/lib/php.ini
在末尾加入以下內(nèi)容
代碼如下:
extension_dir = "/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20100525/"
extension="xcache.so"
[xcache-common]
;; install as zend extension (recommended), normally “$extension_dir/xcache.so”
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so
[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass =
[xcache]
xcache.shm_scheme = "mmap"
xcache.size = 32M
xcache.count = 1
xcache.slots = 8K
xcache.ttl = 3600
xcache.gc_interval = 300
; Same as aboves but for variable cache
; If you don’t know for sure that you need this, you probably don’t
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
; N/A for /dev/zero
xcache.readonly_protection = Off
xcache.mmap_path = "/dev/zero"
xcache.cacher = On
xcache.stat = On
其中,密碼字段xcache.admin.pass可自定義,用md5加密你要的密碼填入,比如
echo -n "vmvps" | md5sum
3.檢驗(yàn)php.ini是否出錯(cuò)
/usr/local/lsws/lsphp5/bin/php -v
如果出現(xiàn)如下錯(cuò)誤
PHP Fatal error: Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0可以通過以下命令解決
perl -pi -e 's/^allow_call_time_pass_reference/;allow_call_time_pass_reference/' /usr/local/lsws/lsphp5/lib/php.ini
以上是“如何手動(dòng)為LiteSpeed安裝eAccelerator和XCache”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!