How to setup Xdebug Remote Debugging?

I tried following the instructions at http://docs.komodoide.com/Manual/debugphp but I don’t see anywhere to set the uri of my server running PHP. I’m hoping to learn how to do this so I can debug Drupal. My client is running Windows 7 and the server is running RHEL 7.

Could you clarify this comment:
but I don't see anywhere to set the uri of my server running PHP

What URI exactly? If it’s the one to start your debug session, you put it in a browser.

  • Carey

Hi careyh, thanks for your response. I’m talking about the domain(or ip) of my server.I don’t know how to get my Komodo IDE to connect with my remote PHP server. When I view my listening status settings my host address is blank and I don’t know how to change that. But maybe I don’t have to change it. Can you help guide me please?

I just tried adding ?XDEBUG_SESSION_START=1 to my domain and that did nothing. Plus I don’t understand how my server is supposed to be communicating with my Komodo session.

It’s hard to tell you what you need to do without knowing all you’ve done so far but i’ll just clarify one thing you might be confused about:

  • Komodo does not contact your application/server to start debugging, your web app/server contacts Komodo. That is what the settings you add to php.ini are for.

php.ini should have the IP address that is routable from the server to the computer running Komodo and the Port configured in Edit > Preferences > Debugger > Connection.

  • Carey

What stops any application/webapp from using my Komodo instance?

I don’t understand the question.

What stops another webapp that isn’t my own from connecting to my Komodo instance? Isn’t that a security concern?

Another application can send debugging data for Komodo to parse if they want to, assuming they know what port to send to and what your IP address was. No PHP is executing on your computer though. PHP is running on the server. Komodo is parsing information about the state of your application, not running it.

If you want to lock down your firewall you could configure it to block any connection on that part that is NOT from your server.

This is standard for remote debugging. The application has to contact the debug server (Komodo) some how.

  • Carey

Gotcha. I think I understand it now.
I assume I’ll need to download a file from http://code.activestate.com/komodo/remotedebugging and put it on my server that has PHP. I tried transfer the linux file over but when I extracted it I don’t know what to do with the files. I don’t see xdebug.so anywhere and I have some Python files.

@AlexCreamer, it sounds like you might have skipped some steps in the docs.

My apologies but I’m gonna have to ask you to please have another read through. Your current question can be answered here:

http://docs.komodoide.com/Manual/debugphp#debugging-php-komodo-ide-only_remote-php-debugging_configuring-remote-php-debugging_step-1-copy-the-debugging-extension-to-the-web-server.

If you still have questions after reading that section let me know.

  • Carey

@careyh I’ve already configured my php.ini but for the part that says, zend_extension="/path/to/xdebug.so", I don’t know what to put considering I don’t see an xdebug.so in the file from the link I gave you (which is the link also linked by the link you gave me).

You download the PHP remote debug bits for your platform, unpack it, find the PHP version folder that you’re using and there your xdebug.so file is. Did you accidentally download the Python remote debugging bits?

  • Carey

Yes, I accidentally downloaded the wrong one. Thanks!

Perfect!

  • Carey

I’m still not able to connect. I added the xdebug.so to my /usr/lib/ and have added the following to my php.ini:
xdebug.remote_enable = 1
xdebug.remote_host = My local computers ip address
xdebug.remote_port=9004
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=“komodo”
zend_extension=/usr/lib/xdebug.so

Komodo is set to read from that port. Perhaps this has something to do with me using Windows on my local machine and the server being Linux? I tried restarting Komodo too, and I have restarted my servers httpd service after making the php.ini changes. My phpinfo shows my xdebug settings being used (although I don’t see the IP I put in the php.ini remote_host.

Is your PHP server on the same network as Komodo? If it’s not then you’re computer is likely going through a router and you cannot route directly from your server to your computer. What exactly is your setup?

  • Carey

My setup is locked down and access is tightly controlled by corporate policies.

You’ll need to figure out how to make you computer running Komodo rout-able from your server running PHP. I can’t help with that.

Your other option is to run a test server locally on your computer and debug from there.

  • Carey