Child pages
  • [debugger] Supporting XDebug PHP extension
Skip to end of metadata
Go to start of metadata

Recently I needed to install ionCube Loader (see http://www.ioncube.com/loaders.php) into my development enviroment to be able to work on project, which code is encrypted using ionCube PHP Encoder (see http://www.ioncube.com/php_encoder.php). Unfortunately Zend Debugger extension I'm using every day for debugging code in my IDE rejected to work at same time, when ionCube Loader extension was loaded into PHP.

I have no doubts, that Zend Guard (see http://www.zend.com/en/products/guard/), which is alternative to ionCube PHP Encoder would have worked without any problems with Zend Debugger extension, since they are both produced by same company. But unfortunately the encrypted software had no version made using Zend Guard.

Looking for Zend Debugger alternatives I've found XDebug (see http://xdebug.org/). Basically XDebug offers same (if not much more) real-time debugging to PHP scripts plus it also enhances build-in PHP functions to allow displaying stack traces upon errors. It seems, though In-Portal don't know how to properly disable it's internal debugger in case if XDebug is being used instead of Zend Debugger. 

P.S.

Also XDebug is open-source and everyone can contribute code or report bugs/suggest features. Comparing to Zend Debugger, which is provided as-is and no bug reports are accepted, this is huge improvement. Actually I've been using XDebug since then and I'm pretty happy. My IDE (which is PHPStorm) integrates with both debuggers anyway.

Solution

It's really easy to fix though - check for XDEBUG_SESSION variable in user request.

Additionally following can be implemented to benefit from xDebug even more:

  1. set the "xdebug.file_link_format" setting via "ini_set" function call to link format used by In-Portal Debugger internally to make file links, that xDebug creates (e.g. in exceptions and notices) lead straight to PhpStorm
  2. rename the DBG_ZEND_PRESENT into DBG_IDE_PRESENT constant in /system/debug.php file and any places where it's used
  3. during debugger initialization, check for case, when DBG_ZEND_PRESENT constant is defined, but DBG_IDE_PRESENT constant is not and:
    • trigger a notice to the user, that he should be using DBG_IDE_PRESENT constant
    • define DBG_IDE_PRESENT constant on the fly with value from DBG_ZEND_PRESENT constant

Related Discussions

Related Tasks

1 Comment

  1. Today I've got a question, over e-mail, about how exactly I've managed to make ionCube Loader work with Xdebug.

    Here is bottom of my /etc/php.ini file:

    [Zend]
    zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so
    zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
    xdebug.cli_color=1
    xdebug.remote_enable=1
    xdebug.collect_params=2
    xdebug.idekey=PHPSTORM
    xdebug.remote_host=10.0.0.1
    xdebug.show_local_vars=1

    The important parts here are:

    1. load ionCube extension before xDebug extension
    2. load both extensions via zend_extension directive, not extension directive, that xDebug adds to the php.ini during it's installation
    3. use the ionCube Loader Wizard for your platform: http://www.ioncube.com/loaders.php

    I can confirm, that described configuration work with:

    • xDebug v2.2.6
    • Linux x64
    • PHP 5.4.34
    • ionCube Loader v4.2.2 (for PHP 5.4 from 26 June 2014); confirmed to work with ionCube Loader v4.7.2 as well.