0

Tools and versions used:

  • Linux Mint 21.1
  • Eclipse IDE for JavaScript ans Web Developers V4.25 (installed from the distrib)
  • Xdebug : v3.1.2
  • OpenJDK 11.0.19 2023-04-18

I installed PDT and Xdebug. phpinfo() shows that Xdebug is installed and configured. The file /etc/php/8.1/cli/conf.d/20-xdebug.ini contains :

zend_extension=xdebug.so
xdebug.mode=debug
xdebug.log="/tmp/xdebug.log"

The project is configured with the right PHP version + Xdebug on port 9003. When I try to run the script in Eclipse the IDE don't stop at breakpoint.

I checked the xdebug.log file :

[13119] Log opened at 2023-06-20 18:01:19.379696
[13119] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[13119] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[13119] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[13119] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[13119] Log closed at 2023-06-20 18:01:19.386709

In the terminal I tried :

$ export XDEBUG_SESSION=1
$ php my-script.php

The script started and in the IDE it stopped at the first breakpoint ! Wow, I didn't expected that.

So I can debug my script this way, but it's not very practical.

I tried also to add the environment variable XDEBUG_SESSION in the "Environment" tab of "PHP CLI Application" configuration. No effect.

I uninstalled the 4.25 version, clean "eclipse-workspace" (removed old Eclipse configuration) and installed the 4.27 version (flatpack). No effect.

I checked and re-checked the IDE configuration and googled a lot, but I don't found the solution.

Xdebug configuration :

Version     3.1.2
Support Xdebug on Patreon, GitHub, or as a business
Enabled Features
(through 'xdebug.mode' setting)
Feature Enabled/Disabled    Docs
Development Helpers ✘ disabled  
Coverage    ✘ disabled  
GC Stats    ✘ disabled  
Profiler    ✘ disabled  
Step Debugger   ✔ enabled   
Tracing ✘ disabled  
Optional Features
Compressed File Support     no
Clock Source    clock_gettime
Diagnostic Log
No messages
Step Debugging  Docs
Debugger    Not Active  
PHP
Build Configuration
Version (Run Time)  8.1.2-1ubuntu2.11
Version (Compile Time)  8.1.1
Debug Build     no
Thread Safety   disabled
Settings
Configuration File (php.ini) Path   /etc/php/8.1/cli
Loaded Configuration File   /etc/php/8.1/apache2/php.ini
Scan this dir for additional .ini files     /etc/php/8.1/apache2/conf.d
Additional .ini files parsed    /etc/php/8.1/apache2/conf.d/10-mysqlnd.ini, /etc/php/8.1/apache2/conf.d/10-opcache.ini, /etc/php/8.1/apache2/conf.d/10-pdo.ini, /etc/php/8.1/apache2/conf.d/15-xml.ini, /etc/php/8.1/apache2/conf.d/20-bz2.ini, /etc/php/8.1/apache2/conf.d/20-calendar.ini, /etc/php/8.1/apache2/conf.d/20-ctype.ini, /etc/php/8.1/apache2/conf.d/20-curl.ini, /etc/php/8.1/apache2/conf.d/20-dom.ini, /etc/php/8.1/apache2/conf.d/20-exif.ini, /etc/php/8.1/apache2/conf.d/20-ffi.ini, /etc/php/8.1/apache2/conf.d/20-fileinfo.ini, /etc/php/8.1/apache2/conf.d/20-ftp.ini, /etc/php/8.1/apache2/conf.d/20-gd.ini, /etc/php/8.1/apache2/conf.d/20-gettext.ini, /etc/php/8.1/apache2/conf.d/20-iconv.ini, /etc/php/8.1/apache2/conf.d/20-intl.ini, /etc/php/8.1/apache2/conf.d/20-mbstring.ini, /etc/php/8.1/apache2/conf.d/20-mysqli.ini, /etc/php/8.1/apache2/conf.d/20-pdo_mysql.ini, /etc/php/8.1/apache2/conf.d/20-phar.ini, /etc/php/8.1/apache2/conf.d/20-posix.ini, /etc/php/8.1/apache2/conf.d/20-readline.ini, /etc/php/8.1/apache2/conf.d/20-shmop.ini, /etc/php/8.1/apache2/conf.d/20-simplexml.ini, /etc/php/8.1/apache2/conf.d/20-sockets.ini, /etc/php/8.1/apache2/conf.d/20-sysvmsg.ini, /etc/php/8.1/apache2/conf.d/20-sysvsem.ini, /etc/php/8.1/apache2/conf.d/20-sysvshm.ini, /etc/php/8.1/apache2/conf.d/20-tokenizer.ini, /etc/php/8.1/apache2/conf.d/20-xdebug.ini, /etc/php/8.1/apache2/conf.d/20-xmlreader.ini, /etc/php/8.1/apache2/conf.d/20-xmlwriter.ini, /etc/php/8.1/apache2/conf.d/20-xsl.ini, /etc/php/8.1/apache2/conf.d/20-zip.ini
Directive   Local Value Master Value    Docs
xdebug.mode debug   debug   
xdebug.start_with_request   default default 
xdebug.start_upon_error default default 
xdebug.output_dir   /tmp    /tmp    
xdebug.use_compression  0   0   
xdebug.trigger_value    no value    no value    
xdebug.file_link_format no value    no value    
xdebug.filename_format  no value    no value    
xdebug.log  no value    no value    
xdebug.log_level    7   7   
xdebug.var_display_max_children 128 128 
xdebug.var_display_max_data 512 512 
xdebug.var_display_max_depth    3   3   
xdebug.max_nesting_level    256 256 
xdebug.cli_color    0   0   
xdebug.force_display_errors Off Off 
xdebug.force_error_reporting    0   0   
xdebug.halt_level   0   0   
xdebug.max_stack_frames -1  -1  
xdebug.show_error_trace Off Off 
xdebug.show_exception_trace Off Off 
xdebug.show_local_vars  Off Off 
xdebug.dump.COOKIE  no value    no value    
xdebug.dump.ENV no value    no value    
xdebug.dump.FILES   no value    no value    
xdebug.dump.GET no value    no value    
xdebug.dump.POST    no value    no value    
xdebug.dump.REQUEST no value    no value    
xdebug.dump.SERVER  no value    no value    
xdebug.dump.SESSION no value    no value    
xdebug.dump_globals On  On  
xdebug.dump_once    On  On  
xdebug.dump_undefined   Off Off 
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p   
xdebug.profiler_append  Off Off 
xdebug.cloud_id no value    no value    
xdebug.client_host  localhost   localhost   
xdebug.client_port  9003    9003    
xdebug.discover_client_host Off Off 
xdebug.client_discovery_header  no value    no value    
xdebug.idekey   no value    no value    
xdebug.connect_timeout_ms   200 200 
xdebug.scream   Off Off 
xdebug.gc_stats_output_name gcstats.%p  gcstats.%p  
xdebug.trace_output_name    trace.%c    trace.%c    
xdebug.trace_format 0   0   
xdebug.trace_options    0   0   
xdebug.collect_assignments  Off Off 
xdebug.collect_return   Off Off 
LazyOne
  • 158,824
  • 45
  • 388
  • 391
P. Debrabant
  • 131
  • 1
  • 13
  • I'm not using Eclipse so cannot help on that part (what needs to be done in the IDE itself) but ... **1)** Which button do you click: "Debug" or "Run"? The later one should just run the script while first should add the needed params/set up the ENV for debug. **2)** You can add `xdebug.start_with_request = yes` to your `20-xdebug.ini` to instruct Xdebug to try to debug **every single request** without the need for having a "debug me" flag (`XDEBUG_SESSION` etc) – LazyOne Jun 24 '23 at 11:10
  • I added "xdebug.start_with_request = yes" to my 20-xdebug.ini. And yes, this time xdebug stops at breakpoint when I run my script from the IDE with the Debug button. But I'd like to debug when I need and not each time. – P. Debrabant Jun 29 '23 at 07:18
  • Well, I'm not familiar with your IDE (never used it) and therefore I cannot say what you *may* be doing wrong... I may only suggest you make a simple test script to debug and then make a bunch of screenshots (or much better -- a video) showing your setup and what exactly you are doing to debug (what do you click etc). This way we might be able to spot something that does not look right.... – LazyOne Jun 29 '23 at 07:54

0 Answers0