0

I have a Laravel backend application and Vue.js 2 frontend application running on Laravel Valet, with SSL enabled. I’ve set up Xdebug with PHP 8.2, and everything works as expected.

When I test API endpoints directly from the browser or from postman, the breakpoints are hit in PhpStorm, confirming that my Xdebug and server configuration in PhpStorm is correct.

However, when the frontend makes API calls to the Laravel backend, the debugger doesn’t stop at breakpoints

Despite setting the frontend URL with port 443 and specifying the absolute backend path in PhpStorm, Xdebug redirects to the Valet path:

/home/ahmed/.config/composer/vendor/cpriego/valet-linux/server.php

The code execution stops at this line:

define('VALET_HOME_PATH', posix_getpwuid(fileowner(__FILE__))['dir'] . '/.valet');

When I try to resume the program, it doesn’t continue to the Laravel code breakpoints.

Also there is no Cookie is set in frontend browser with XDEBUG_SESSION=PHPSTORM

even the Xdebug extension is enabled

5
  • "Also there is no Cookie is set in frontend browser with XDEBUG_SESSION=PHPSTORM" AFAIK this does not set the cookie. Better use Xdebug browser extension to enable/disable Xdebug cookie -- jetbrains.com/help/phpstorm/browser-debugging-extensions.html Commented Sep 23, 2024 at 20:53
  • @LazyOne Yes I already using Xdebug browser extension, it is already working fine with calling API calls from backend domain, but in frontend domain it is not added Commented Sep 24, 2024 at 6:04
  • What that extension does, it sets the Xdebug cookie for the current domain. If your API calls go to another domain (e.g. subdomain, or even on a different explicit port (e.g. the website is on mydomain.com and API is on mydomain:3000) then the cookie should not stick. Double check this with your browser Network tab -- see what the request to such an endpoint has (cookies or GET/POST params). Commented Sep 24, 2024 at 8:42
  • About "The code execution stops at this line:" -- please show a screenshot of what you have at "Settings/Preferences | PHP | Debug" and perhaps "Settings/Preferences | PHP | Servers" as well Commented Sep 24, 2024 at 8:45
  • 1
    You might have to figure out how to add the XDEBUG_SESSION=PHPSTORM as GET or POST parameter when the frontend makes API calls. Commented Oct 13, 2024 at 16:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.