Home > Backend Development > PHP Tutorial > Debugging method of php CLI application (picture and text)

Debugging method of php CLI application (picture and text)

不言
Release: 2023-04-04 11:02:01
forward
3758 people have browsed it

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.

Debugging method of php CLI application (picture and text)

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:

Debugging method of php CLI application (picture and text)

##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:

Debugging method of php CLI application (picture and text)

What about Eclipse?

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

Debugging method of php CLI application (picture and text)

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:

Debugging method of php CLI application (picture and text)

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

Debugging method of php CLI application (picture and text)

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template