Using the debugger on an SSH workspace


#1

Hi All,

I have an SSH workspace, configured as a dev environment for a client. Unfortunately I’m struggling to use the c9 Debugger tool as I would on a regular workspace.

Normally, I would do the following to debug:

  • Set my breakpoints.
  • On the toolbar, select Run > Run With > PHP (built in webserver)
  • On the tab for this runner, select the Debug icon, (and check the runner is still on PHP (built in webserver))
  • Start debugging

Sadly, this doesn’t happen in the SSH workspace. In particular, when I attempt to start or restart the runner I get:

Starting PHP built-in web server, serving https://x.x.x.x/index.php.
[Wed Mar  9 09:03:45 2016] Failed to listen on 0.0.0.0:8080 (reason: Address already in use)

I’m not sure how to interpret this error message. And therefore am unable to get this debugger working. Please could anyone advise.

Regards
Ash


#2

looks like some other process uses 8080 port.
use lsof -i :8080 to find out which one.


#3

Hmm that command returns loads of processes:

COMMAND    PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
varnishd  9999   nobody   14u  IPv4 3628930      0t0  TCP localhost:45653->localhost:http-alt (CLOSE_WAIT)
apache2  18863     root    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30290 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30574 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30667 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30764 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30858 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30908 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  30974 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  31011 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  31078 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)
apache2  31130 www-data    4u  IPv6  174111      0t0  TCP *:http-alt (LISTEN)

I’m assuming they are all something to do with it being an SSH workspace.

I guess thinking about, it doesn’t really make sense that I’m firing off another runner, since the site is already running. Probably I want to just configure it like a regular remote debug. Hmmm.


#4

You could stop apache and start php runner or add a dummy runner just for starting the debugger that will attach to exiting apache2 process.

To create a dummy runner copy the runner from https://github.com/c9/c9.ide.run/blob/master/runners-docker/Apache%20httpd%20(PHP%2C%20HTML).run#L3 and replace the command with "sleep", "10000"
You’ll also need to install and enable xdebug see https://github.com/c9/c9.ide.run.debug.xdebug#c9iderundebugxdebug


#5

Fantastic, that fixed it. After I stopped Apache the “PHP (built in webserver)” runner began working properly. So I didn’t event use that dummy runner.

Then I ssh-ed onto the server and installed xdebug and it worked.

Thanks so much! I’ve been looking to do this for a while now.