閱讀168 返回首頁    go 阿裏雲 go 技術社區[雲棲]


eaccelerator0.9.5.3模塊安裝

當然環境用的軍哥的lnmp一鍵包,當前版本Centos6.9 nginx1.10 php5.5.36 mysql5.6.29

因為當前公司有網站需要遷移,在遷移的過程中,發現eaccelerator0.9.5.3無法在現有php版本運行,經過一番查找,發現eaccelerator0.9.5.3版本隻支持php5.2.x版本,並且隻有這個版本支持數據緩存,好坑有沒有~

目前eaccelerator最新的版本是1.0dev,最高隻支持5.4.x,而且隻是對php做加速處理(PS:已經好幾年不更新了,如果不是程序需要,就不要搞它了)

因為當前php版本是5.5.36的,並且當前已經有網站在運行了,為了不影響當前網站的訪問,我這裏並存一個php5.2的版本(php共存方式,我博客有寫,此處不在說明)

下載及編譯安裝

下載eaccelerator-0.9.5.3包

wget https://down.whsir.com/downloads/eaccelerator-0.9.5.3.tar.bz2
tar xf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
/usr/local/php52/bin/phpize

根據自己phpize的位置來運行即可(不知道phpize在哪的直接find / -name phpize查找),運行完提示下麵信息,然後編譯即可

Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

編譯(注意:要想使用共存內存緩存功能eaccelerator_get and eaccelerator_put among others,此處必須要這麼編譯,如果不按這種方式編譯,php會報Call to undefined function eaccelerator_get() in錯誤

./configure --enable-eaccelerator=shared --with-eaccelerator-shared-memory --with-eaccelerator-info --with-eaccelerator-sessions --with-eaccelerator-content-caching --with-eaccelerator-disassembler --with-eaccelerator-debug --with-php-config=/usr/local/php52/bin/php-config
make && make install

上述執行完後會有如下提示:

Installing shared extensions: /usr/local/php52/lib/php/extensions/no-debug-non-zts-20100525/

通過ll就可以到該模塊了

ll /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/

修改php.ini文件

vim /usr/local/php52/etc/php.ini

直接在最下麵添加

[eaccelerator]
zend_extension="/usr/local/php52/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter="*.php"
eaccelerator.log_
eaccelerator.shm_max="0"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_ttl="300"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path = "/opt/www/control"
eaccelerator.name_space = "whsir"

eaccelerator提供了監控與管理eAccelerator緩存的功能,通過control.php來管理,所以此處拷貝到相應網站目錄下(不是必須的

cp control.php /opt/www/control/control.php

默認帳號密碼為

admin
eAccelerator

創建eaccelerator_cache目錄

mkdir /tmp/eaccelerator_cache

修改下目錄權限

chmod -R 777 /tmp/eaccelerator_cache

重啟php52服務

/etc/init.d/php52-fpm restart

此時打開phpinfo就可以看到該模塊了

最後更新:2017-07-10 12:02:19

  上一篇:go  編譯redis報錯/deps/hiredis/libhiredis.a解決
  下一篇:go  CentOS6.7配置軟raid5(模擬故障增加硬盤)