Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the debugging principle of PHP CLI application?

Shulou Source: shulou.com Published: 2022-06-03 03:27:41 10月14日 Update

PHP CLI application debugging principle is what, many novices are not very clear about this, in order to help you solve this problem, the following small series will be explained in detail for everyone, there are people who need this can learn, I hope you can gain something.

Select a PHP file in Eclipse and right-click Debug As->PHP CLI Application.

CLI application means that this script file does not need any Web server to run, of course, PHP runtime is still required.

We see XDebug in the debug window that pops up:

XDebug is a great tool for debugging PHP. In my folder C:MyAppwampinphpphp5.5.12 there is a php.ini configuration file with this configuration at the end:

; 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, when I debugged my PHP CLI application with Eclipse, 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 est ewfile.php

-n option: do not use global php.ini file

-c option: Use php.ini specified after-c, i.e. C:Usersi042416AppDataLocalTempphp-inisession 2307282238017995350.tmpphp.ini

-d option: temporarily specify a parameter not found in php.ini, i.e. asp_tags=off

Take a look at this php.ini file that I generated temporarily after I started CLI debugging:

Although there are more than 70 k, but the vast majority of comments are semicolons, only the last few lines are valid information:

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Tags: File application help run configuration principle valid clear task location information global content semicolon sharp weapon parameter only command actually actually Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn NVidia Xiaomi macOS Huawei