xdebug breakpoint not hitting on external libraries / external project
i've not been able to figure out whether this is a supported feature in xdebug/phpstorm combination.
basically my breakpoints work fine if i'm triggering them on the same project but not when the files are in another project, eg
let's say i have the following project spaceship and api, each residing in another folder :
c:\myproject\spaceship\*.all files
c:\myproject\api\*.all files
normally:
http://localhost/spaceship will hit any breakpoints in spaceship project as long as they're in the same folder.
now that i need to debug the api from myproject\api, but still using the same web path, the breakpoints will be ignored.
http://localhost/spaceship
i tried the following to get it work :
while opening the project workspace in spaceship, i added project api as an external library..then manually browsed to a file in php and set a breakpoint then ran http://localhost/spaceship (not working)
open the spaceship project workspace and set the breakpoint and ran http://localhost/spaceship, (ignored too)
i tried outputting the xdebug log and i do see my breakpoints getting set too :
<- breakpoint_set -i 10 -t line -f file://C:/myproject/api/somelibrary.php -n 12
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="10" id="123456"></response>
but there's no status="break" found in the api files, even though it can break if it was the spaceship project
Please sign in to leave a comment.
IDE needs file mapping to associate files in project and files opened in browser during debug.
You might try to attach "api" project to "spaceship" project. After that go to Tools > Deployment > Configuration. Find you deployment server > Mappings tab. You'll either get prompted to add another mapping or just click "Add another mapping there" and fill in your second project folder mapping.
Hi Dmitry, thanks for your reply. I tried a few things :
1. attached api to spaceship project by using file /attach
2. went to tool/deployment/connection and set type to 'in place', browse files on server set to http://local.api/
3. mappings :
local path :
c:\myprojects\mysite\api
c:\myprojects\mysite\spaceship
web path:
http://local.api
http://local.spaceship.com
and went to debug configuration and ticked on 'use path mappings' (doesn't seem to make any difference with or without this)
and the breakpoint in api is still being ignored...
Hi,
Did you try to specify the mappings manually in Languages & Frameworks | PHP | Servers?
yes, but it didn't make any difference even if i don't use path mappings.
the setting was :
file/directory :
c:\myprojects\mysite\spaceship
c:\myprojects\mysite\api
absolute path :
c:/myprojects/mysite/spaceship
c:/myprojects/mysite/api
(the backslash seems to become forward slash itself after clicking on ok or apply button)
Hi there,
You have to provide some details on how this API works (how do you use it in your main project).
I mean -- is that some plain PHP library ("local" PHP code that runs in the same process -- just like another typical PHP library, e.g. SwiftMailer/Twig/Smarty etc) or it's some sort of RESTful API or alike where extra connections/external calls got made/processes get spawned?
If 2nd/3rd one -- it will be a separate PHP request so you have to either add "debug me" xdebug parameter to such request (GET/POST data or COOKIE) or configure xdebug to attempt to debug every single request (xdebug.remote_autostart = 1). Please refer to xdebug documentation for this.
You may also need to ensure that max number of debug sessions (in PhpStorm settings) is bigger than 1 (was the default in PhpStorm 2016.3 and older -- in 2017.1 should be "2" or "3" by default). Since it's a per-project setting, such new value may remain just "1" if project was created in older version.