Make sure you have the correct XDebug version for your version of PHP and add it at the very beginning of your php.ini file:
[xdebug] zend_extension=full_path_to_your_xdebug.so xdebug.default_enable=On xdebug.remote_enable=On xdebug.remote_handler="dbgp" xdebug.remote_host="localhost" xdebug.remote_port=9000
Then run apachectl graceful and a phpinfo and make sure XDebug is present and active. If so, everything should work fine. I know this is for me.
edit: I answered before reading the whole question.
Before running the script, you must set the environment variable;
export XDEBUG_CONFIG="idekey=session_name"
It may be possible to do this from php, but I cannot verify this:
putenv('XDEBUG_CONFIG="idekey=session_name"');
You have to make sure that the php binary you are using contains the XDebug extension, there is an apache module on my system, but the CLI interpreter does not do this by default, but I run different versions on purpose.
There is good documentation here
Kris
source share