0

I want to debug an API function that handles an HTTP POST request. My PHPstorm is set up to work with the Chrome browser extension, and works fine.

When I manually create a POST request, using Postman or PHPStorm's own REST testing tool, there's no Xdebug header being sent though, and I can't break within the function handling that request.

Manually adding XDEBUG_SESSION_START="PHPSTORM" to the request header didn't help. Is there maybe another way to debug such a request that's not initiated by the browser?

Update: I've tried cookies as well, capturing them from Chrome (see below). No difference. enter image description here

Lars
  • 523
  • 1
  • 6
  • 20
  • *"Manually adding XDEBUG_SESSION_START="PHPSTORM" to the request header didn't help."* What "request header"? It has to be either query string or POST data. Try using cookie instead (work fine). – LazyOne Aug 10 '15 at 11:12
  • Related: http://stackoverflow.com/a/19147935/783119 – LazyOne Aug 10 '15 at 11:25

2 Answers2

0

Try adding Cookie: XDEBUG_SESSION_START=PHPSTORM To the headers instead

DGS
  • 6,015
  • 1
  • 21
  • 37
  • Had no success with that. I even captured the cookies form Chrome, using "Postman Interceptor", no difference. – Lars Aug 10 '15 at 11:16
  • @Lars Well, in such case `xdebug.remote_autostart = 1` in your `php.ini`. NOTE that it will attempt to debug **every single** request processed by PHP interpreter that uses that php.ini. Alternatively -- add `xdebug_break();` in actual PHP code... – LazyOne Aug 10 '15 at 11:23
0

Putting XDEBUG_SESSION_START="PHPSTORM" into the body of the request did the trick.

Seems I've missed that the first time I tried it, because I had created a new debug environment without realising path mappings where missing.

Strangely enough, setting the cookies did nothing.

Lars
  • 523
  • 1
  • 6
  • 20