Issue
I think I've all tried but I just can't use Xdebug with NetBeans on Ubuntu 20.04, there's a message "Waiting For Connection (netbeans-xdebug)" displayed at the bottom of the IDE.
If I use phpinfo()
, I can see that Xdebug is enabled, here's my xdebug.ini configuration file :
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=0
xdebug.client_port=9000
xdebug.client_host=127.0.0.1
xdebug.remote_handler=dbgp
In NetBeans my settings in Options -> PHP -> Debugging are :
Debugger Port: 9000
Session ID : netbeans-xdebug
Maximum Data Length : 2048
Stop at First Line : unchecked
Watches and Balloon Evaluation : unchecked
Show Requested URLs : checked
Show Debugger Console : checked
I know that this question has been asked douzains of times but most of them are old and none of the answers are working. This drives me crazy so any help would be appreciated !
-- Edit :
Here is the content of the xdebug.log file :
[21406] Log opened at 2021-01-21 12:42:36.233357
[21406] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9000.
[21406] [Step Debug] WARN: Creating socket for '127.0.0.1:9000', poll success, but error: Operation now in progress (29).
[21406] [Step Debug] ERR: Could not connect to debugging client. Tried: 127.0.0.1:9000 (through xdebug.client_host/xdebug.client_port) :-(
[21406] Log closed at 2021-01-21 12:42:36.234607
And here is the outpout of xdebug_info() :
PHP
Build Configuration
Version 7.4.14
Debug Build no
Thread Safety disabled
Settings
Configuration File (php.ini) Path /etc/php/7.4/cli
Loaded Configuration File /etc/php/7.4/apache2/php.ini
Scan this dir for additional .ini files /etc/php/7.4/apache2/conf.d
Additional .ini files parsed /etc/php/7.4/apache2/conf.d/10-mysqlnd.ini, /etc/php/7.4/apache2/conf.d/10-opcache.ini, /etc/php/7.4/apache2/conf.d/10-pdo.ini, /etc/php/7.4/apache2/conf.d/15-xml.ini, /etc/php/7.4/apache2/conf.d/20-calendar.ini, /etc/php/7.4/apache2/conf.d/20-ctype.ini, /etc/php/7.4/apache2/conf.d/20-curl.ini, /etc/php/7.4/apache2/conf.d/20-dom.ini, /etc/php/7.4/apache2/conf.d/20-exif.ini, /etc/php/7.4/apache2/conf.d/20-ffi.ini, /etc/php/7.4/apache2/conf.d/20-fileinfo.ini, /etc/php/7.4/apache2/conf.d/20-ftp.ini, /etc/php/7.4/apache2/conf.d/20-gd.ini, /etc/php/7.4/apache2/conf.d/20-gettext.ini, /etc/php/7.4/apache2/conf.d/20-iconv.ini, /etc/php/7.4/apache2/conf.d/20-json.ini, /etc/php/7.4/apache2/conf.d/20-mbstring.ini, /etc/php/7.4/apache2/conf.d/20-mysqli.ini, /etc/php/7.4/apache2/conf.d/20-pdo_mysql.ini, /etc/php/7.4/apache2/conf.d/20-phar.ini, /etc/php/7.4/apache2/conf.d/20-posix.ini, /etc/php/7.4/apache2/conf.d/20-readline.ini, /etc/php/7.4/apache2/conf.d/20-shmop.ini, /etc/php/7.4/apache2/conf.d/20-simplexml.ini, /etc/php/7.4/apache2/conf.d/20-sockets.ini, /etc/php/7.4/apache2/conf.d/20-sysvmsg.ini, /etc/php/7.4/apache2/conf.d/20-sysvsem.ini, /etc/php/7.4/apache2/conf.d/20-sysvshm.ini, /etc/php/7.4/apache2/conf.d/20-tokenizer.ini, /etc/php/7.4/apache2/conf.d/20-xdebug.ini, /etc/php/7.4/apache2/conf.d/20-xmlreader.ini, /etc/php/7.4/apache2/conf.d/20-xmlwriter.ini, /etc/php/7.4/apache2/conf.d/20-xsl.ini
Directive Local Value Master Value Docs
xdebug.mode debug debug 🖹
xdebug.start_with_request yes yes 🖹
xdebug.start_upon_error default default 🖹
xdebug.output_dir /tmp /tmp 🖹
xdebug.trigger_value no value no value 🖹
xdebug.file_link_format no value no value 🖹
xdebug.filename_format no value no value 🖹
xdebug.log /var/log/xdebug.log /var/log/xdebug.log 🖹
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 127.0.0.1 127.0.0.1 🖹
xdebug.client_port 9000 9000 🖹
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 🖹
Solution
It's just black magic but anyway, it works. Thanks a lot
If it can help anyone, I hadded the xdebug.idekey to my .ini file and to have it running :
- In Netbeans I click on the "Debug Project" button, it starts waiting for xdebug
- In my browser (Chromium) I have to launch the url manually to start debugging
I tried using Firefox instead of Chromium for debugging and it's working as expected.
Answered By - RenaudMG
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)