问题
I came across a very annoying problem today. Sometimes I have to debug php command line scripts, for this I used Eclipse PDT with Zend Debugger. It was buggy, but it worked. Until I updated my PDT, and now none of my cli debug configurations work ('PHP Web Page' types do fine, only cli is wrong). If I try to start one, I get an error message:
The debug session could not be started. Please make sure that the debugger is properly configured as a php.ini directive.
This is very interesting, since the update of Eclipse was the only change I made. What could be the problem? I'm using Eclipse Helios, PHP 5.3.2 with Zend Debugger 5.2 on Ubuntu 10.04.
回答1:
I just ran into a similar issue, also after only the IDE (eclipse) was updated. I think this may be a bug.
I am using xdebug not zend debug, and html debugging is working fine. Cli debug (any way you try, just does not debug)
From what I can see, the debug directives for Cli debugging is not loading the correct php.ini file, and defaulting to some 'plain vanilla file??' (hence why it does not find your zend ini directives)
I can see this happening by creating a simple .php file that just outputs phpinfo() When the cli is run (or debug) from eclipse you get: (and I have /etc/php5/apache2/php.ini in my 'optional' php.ini file location in prefs)
----- snip ---- ....
Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /tmp/zend_debug/session1681149270511982227.tmp/php.ini
..... ----- snip ----
Running that from actual command line gives: (ubuntu 10.10)
----- snip ---- ....
Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /etc/php5/cli/php.ini
..... ----- snip ----
If you setup your breakpoints inside eclipse, and start the script from the shell, the breakpoints activate (in my case it even runs to a zend_debug folder, and I am using xdebug)
来源:https://stackoverflow.com/questions/4352975/cant-debug-php-cli-after-eclipse-update