PHP Remote Debugging using XDebug

eclipse-pdtPHPremote-debuggingxdebug

I've got a lot of questions about how to debug php-files with xdebug and eclipse on a remote server.

What I would like to achieve is:
I have a remote server (with WAMPP (appache (Port 8502), php, mysql (Port 8501), etc)) and I would like to debug the php-files with Eclipse PDT from my local PC.

I prepared the following things:

  • Installed Eclipse PDT (Build id:
    20100617-1415) on my local PC
  • Installed and activated xdebug on the
    remote server (available at (lets
    say) 111.111.111.111:8502) with the
    following configuration within the
    php.ini

[XDebug]
zend_extension = C:\TYPO3_4.4.6\php\ext\php_xdebug-2.1.0-5.3-vc6.dll
xdebug.profiler_output_dir = "C:/xampp/tmp/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%p"
xdebug.profiler_enable = 0
xdebug.profiler_append=0
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=ECLIPSE_DBGP
xdebug.remote_log="C:\TYPO3_4.4.6\tmp\xdebug\xdebug_remote.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0

  • In Eclipse I added the server in
    "Window – PHP – PHP Servers" with the
    URL "http://111.111.111.111:8502" and
    the Path Mapping – Path on Server:
    "C:\TYPO3_4.4.6\htdocs" and Path in
    Workspace: "/debug_test" (I created a
    PHP Project named "debug_test").

  • I also changed the PHP – Debug to the following:

    • PHP-Debugger: XDebug
    • Server: 111.111.111.111
    • PHP Executable None Defined
  • Next I added the debug configuration (PHP Web Page):

    • Server Debugger: XDebug
    • PHP Server: 111.111.111.111
    • File: /debug_test/debug.php
    • Break at first line: off
    • Auto Generate: on
  • I created the file debug.php on the Remote Server at C:\TYPO3_4.4.6\htdocs\debug_test\ and within my PHP Project ("debug_test").

If I now run "Debug" and choose my Configuration File, the Webpage pops up (in an external browser) with the URL http://111.111.111.111:8502/debug_test/debug.php?XDEBUG_SESSION_STOP_NO_EXEC=ECLIPSE_DBGP&KEY=129657398681515 and the page is (fully) loaded as a normal page, but there is no way to debug it. Even If I switch to the PHP Debug – View and insert any breakpoints or things like this, there is nothing like debugging.

How do I get to the point that I can do remote debugging with xdebug and eclipse pdt?

Cheers,
Cheeesi

Best Answer

are you sure that your XDebug-Client / PC can be reached by 127.0.0.1 from your server?

B/c if I understand you correctly the your server is not installed on your PC. OTOH then I'm wondering about how you set up ypur XAMPP-system. B/c then usually all your stuff is locally installed.

Also the Browser's behaviour is important. If after invoking an XDebug-session through Eclipse your site is fully loaded, then your XDebug-Client in Eclipse couldn't reach your server. If you see your browser trying to load the page but it's stalling, then your client could tell the server to start an XDebug-session but your XDebug on the server couldn't connect back.

Your port 8502 that you specify for your server is also bit odd, but could be correct, given the corresponding configurations.

Best regards

Raffael

EDIT: and for a first try you should enable break on first line