Jump to content

Trouble with Xdebug Breakpoint using Sublime Text


VaderDark
Go to solution Solved by kicken,

Recommended Posts

Here is my php.ini:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.log=/home/vader/Downloads/xdebug.log
xdebug.idekey=sublime
xdebug.remote_connect_back = Off
xdebug.client_host=somesite.local

In hosts:

127.0.0.1 somesite.local

In httpd-hosts:

<VirtualHost *:80>
    ServerName somesite.local
    DocumentRoot /home/vader/public_html/someclient/somesite/drupal/web/
</VirtualHost>

My phpinfo() says this:

xdebug.client_discovery_header  HTTP_X_FORWARDED_FOR,REMOTE_ADDR  HTTP_X_FORWARDED_FOR,REMOTE_ADDR
xdebug.client_host  somesite.local  somesite.local
xdebug.client_port  9003  9003

xdebug.idekey sublime sublime
xdebug.log  /home/vader/Downloads/xdebug.log  /home/vader/Downloads/xdebug.log
xdebug.log_level  7 7
xdebug.max_nesting_level  256 256
xdebug.max_stack_frames -1  -1
xdebug.mode develop develop
xdebug.output_dir /tmp  /tmp

My Xdebug helper extension for Firefox says:

IDE key = sublime

and the icon is green (enabled).

My Xdebug settings in Sublime text are:

{
   // "path_mapping": {
   //     "/home/vader/public_html/someclient/somesite/drupal/web/": "/home/vader/public_html/someclient/somesite/drupal/web"
  //  },
    "ide_key": "sublime",
  //  "port": 9003,  // Update this line
  ///  "remote_enable": true,
//    "remote_host": "somesite.local",
  //  "remote_port": 9003,  // Update this line
    "client_host": "somesite.local",
    "client_port": 9003,  // Update this line
}

including my other attempts.

I create a breakpoint in Submlime and Start Debugging and load a page, and nothing happens. If I put a "echo 1;die;" just before the breakpoint, that works, meaning I know it's executing that code.

What am I doing wrong?

Link to comment
Share on other sites

  


I actually want to debug a custom Drupal 9 module, but to test Xdebug I have a file

/home/vader/public_html/someclient/somesite/drupal/web/phpinfo.php

with this code:

<?php

echo 1;

echo 2;

die;

I load http://somesite.local/phpinfo.php and I see 12.

Then in Sublime Text, next to the echo 1; I right click and choose 'Xdebug -- Add/Remove Breakpoint' and I see that it adds a brown dot (image attached).

Then I select 'Xdebug -- Start Debugging' in Sublime (and it opens two windows on the bottom of the display) and I select "Debug" in my Firefox Xdebug helper extension (so the icon is green).

I refresh the page http://somesite.local/phpinfo.php and I see 12. I was expecting to see 1 or to see nothing, and then to see some way to examine variables etc. in Sublime.

Screenshot_2023-12-05_14-12-29.png

Link to comment
Share on other sites

  • Solution
On 12/4/2023 at 8:25 AM, VaderDark said:
xdebug.mode develop develop

In order to use step debugging, xdebug.mode needs to contain debug.

If it still does not work after adding that, try setting xdebug.start_with_request to yes.

I have not used either sublime or that browser extension, so not sure if they need anything special.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.