XDebug and RESTful server using PHPStorm or POSTman

后端 未结 4 810
灰色年华
灰色年华 2020-11-28 20:04

How can I get a REST client (such as the one built into PHPStorm or POSTman) to work with XDebug?

In my current set-up of XDebug, using PHPStorm and the Bookmarklet

相关标签:
4条回答
  • 2020-11-28 20:44

    Until http://youtrack.jetbrains.com/issue/WI-17031 will be implemented you can try one of these approaches:

    1. Configure your xdebug (by editing php.ini) to attempt to debug every php script (xdebug.remote_autostart = 1)

    2. Add xdebug session start parameter to the actual URL (XDEBUG_SESSION_START={{KEY}} -- http://xdebug.org/docs/remote ), for example: ?XDEBUG_SESSION_START=PHPSTORM

    3. Pass xdebug cookie as one of the headers (the one which is set by bookmarklet or browser extension, for example)

    For this to work -- make sure that "phone handle" icon is activated (Run | Start Listen for PHP Debug Connection) in advance.

    0 讨论(0)
  • 2020-11-28 20:47

    This was driving me crazy. I just updated to PHP 7.1 and xdebug that was working no longer worked. I updated the xdebug.so file (Linux) and php --version indicated that xdebug was indeed being loaded and working. But when I would use Postman the debugger never kicked on.

    Here's the solution. If you are using Apache as your server then you need to enable the PHP 7.1 mods and reboot Apache: sudo service apache2 restart

    0 讨论(0)
  • 2020-11-28 21:01
    xdebug.remote_timeout = 60000
    

    Worked for me. As my Mac was very slow, and Remote debugger was timed out after 200 ms (Default value)

    0 讨论(0)
  • 2020-11-28 21:11

    https://github.com/tacnoman/dephpugger This lib run the debugger in terminal ( like ipdb for Python and Byebug for Ruby ). Is very easy to use and there is example how to run php cli scripts and webserver.

    0 讨论(0)
提交回复
热议问题