Pages

Thursday, 27 February 2014

Linux VPS Nginx+PHP環境下安裝ionCube

在自己的VPS上安裝試一下,但是提示:Site error: the file /home/test/whmcs/index.php requires the ionCube PHP Loader ioncube_loader_lin_5.2.so to be installed by the site administrator.

根據上面的提示看來是因為沒有安裝ionCube。(註:安裝了lnmp一鍵安裝包的可以在lnmp解壓后的目錄執行./ionCube.sh 進行安裝。)

首先,執行uname -a 查看系統是32位還是64位,打開http://www.ioncube.com/loaders.php頁面根據Linux是32位還是64位下載適當的軟體包,比如我的是32位的,切換到/usr/local/目錄,執行cd /usr/local ,wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz 下載,再執行tar zxvf ioncube_loaders_lin_x86.tar.gz 解壓軟體包。

修改/usr/local/php/etc/php.ini 在文件尾部添加如下代碼:

[ionCube Loader]
zend_extension="/usr/local/ioncube/ioncube_loader_lin_5.2.so"

如果以前裝有Zend Optimizer,安裝ionCube會和Zend Optimizer發生衝突,再執行/usr/local/php/php-fpm reload 時會發生如下錯誤:The Loader must appear as the first entry in the php.ini file in Unknown on line 0

須將Zend Optimizer的代碼放在ionCube的後面,如LNMP中是如下代碼,修改完成再執行/usr/local/php/php-fpm restart 。

[Zend Optimizer]
zend_optimizer.optimization_level=1
zend_extension="/usr/local/zend/ZendOptimizer.so"

修改完成,記得/usr/local/php/php-fpm reload 重新載入配置,查看phpinfo。
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with the ionCube PHP Loader v3.3.10, Copyright (c) 2002-2009, by ionCube Ltd