0

I have two applications running locally, one is written in golang, and the other is PHP. Whenever I debug the php application by accessing it through the browser with my xdebug helper extension enabled the breakpoints work fine inside of PhpStorm, and it logs to the log file as well.

I have the following in my php.ini inside of the php/apache2 and php/cli directories.

[xdebug]
zend_extension = /usr/lib/php/20131226/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = "localhost"
xdebug.remote_log = "/var/log/httpd/xdebug_log"

When I access the application in the browser I use my virtual host somesite.dev and when I do the API request from the other application I send it to somesite.dev/api/someendpoint, nothing is registered in the log file etc.

In PhpStorm settings I have unchecked "Ignore external connections through unregistered server configurations", checked "Detect path mappings from deployment configuration", checked "Break at first line in php", checked "Can accept external connections". And I have my somesite.dev created as a server inside of "Languages and Frameworks > PHP > Servers"

Have anyone experience triggering the breakpoints in xdebug from a local RESTful API?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
DenLilleMand
  • 3,732
  • 5
  • 25
  • 34
  • 1
    Together with the request you need to send "debug this" marker. Since it's done via some API and not the browser viewing the page itself ... you may need to add it manually. It could be 1) xdebug cookie (same as xdebug browser extension does) 2) xdebug GET/POST parameter. Alternatively -- 3) just tell xdebug to attempt to debug every single incoming request regardless of the cookie/parameter -- `xdebug.remote_autostart = 1` – LazyOne May 03 '17 at 14:32
  • 1
    P.S. You may use RESTful-oriented tools to make such requests: e.g. `Tools | Test RESTful Web Services` in PhpStorm (you can initiate debug session from there) .. or Postman in Chrome or alike. In any case -- this looks like pretty decent match/answer: http://stackoverflow.com/a/19147935/783119 – LazyOne May 03 '17 at 14:36

0 Answers0