Wednesday, July 27, 2011

FreeBSD 64bit php 5.3 ioncube Zend xcache

This is mostly a reminder for myself, when installing ioncube from FreeBSD ports an ioncube.ini loader is created (or exists) in /usr/local/etc/php

If you have xcache installed, there is also a /usr/local/etc/php/xcache.ini

When firing up php (php -v / php -m), you will receive an error:

PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0

The reason is due to the defaults in xcache.ini. Xcache is loaded as a full module instead of a Zend extension. Change the xcache.ini file to load it as a Zend extension, and prepend the load lines with the ioncube lines like so:

[Zend]
zend_extension="/usr/local/lib/php/20090626/ioncube/ioncube_loader.so"
zend_extension_ts="/usr/local/lib/php/20090626/ioncube/ioncube_loader_ts.so"

[xcache-common]
;; install as zend extension (recommended, but not working yet)
zend_extension = /usr/local/lib/php/20090626/xcache.so
zend_extension_ts = /usr/local/lib/php/20090626/xcache.so
;; or install as extension
;;extension = xcache.so


PHP 5.3.6 with Suhosin-Patch (cli) (built: Jul 7 2011 09:16:37)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with the ionCube PHP Loader v4.0.9, Copyright (c) 2002-2011, by ionCube Ltd., and
with XCache v1.3.2, Copyright (c) 2005-2011, by mOo

1 comment:

Simon said...

Thanks, I had a similar problem and not quite sure why it works, but I got ioncube running when I renamed "ioncube.ini" to "20-ioncube.ini". I guess it has something to do with the loading order.