The content of this article is about the debugging method of PHP CLI application (pictures and texts). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
We select a PHP file in Eclipse, right-click and select Debug As->PHP CLI Application.

The so-called CLI application means that this script file does not require any web server to run. Of course, PHP is still required to run.
We saw XDebug in the pop-up debug window:

##XDebug is a powerful tool for PHP debugging. There is a php.ini configuration file in my folder C:MyAppwampinphpphp5.5.12. There is such a configuration at the end of the file:
; XDEBUG Extension
zend_extension = "C:/MyApp/ wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll"
;
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug. profiler_output_dir = "C:/MyApp/wamp/tmp"
xdebug.show_local_vars=0
This actually indicates the location of XDEBUG:

What about Eclipse?
Using Task Manager to view, when I used Eclipse to debug the PHP CLI application, a PHP.exe process appeared:

Command prompt line:
C:MyAppwampinphpphp5.5.12php.exe -n -c C:Usersi042416AppDataLocalTempphp-inisession2307282238017995350.tmpphp.ini -d asp_tags=off -d short_open_tag=on C:Usersi042416scp20180425 estewfile.php
-n option: do not use the global php.ini file
-c option: use the php.ini specified after -c, that is, C:Usersi042416AppDataLocalTempphp-inisession2307282238017995350.tmpphp.ini
-d option: Temporarily specify a parameter that is not in php.ini, that is, asp_tags=off
Look at this php.ini file that was temporarily generated after I started CLI debugging:

Although there are more than 70k, most of them are comments starting with a semicolon. Only the last few lines are valid information:

I hope this article will help you understand the principles of debugging PHP CLI applications using XDebug in Eclipse.
The above is the detailed content of Debugging method of php CLI application (picture and text). For more information, please follow other related articles on the PHP Chinese website!