0
votes

I have an iOS mobile application and REST API written in Laravel PHP. My goal is to set a breakpoint in one of my API endpoints in PHP code in PhpStorm IDE, and using a mobile application hit that breakpoint and debug.

I have Xdebug installed and it's listening on port 9000.

If I run a built-in PHP Web Server using PhpStorm configuration, start listen to PHP Debug Connections and simply go to http://localhost:9000/index.php in Chrome browser, I do succeed to hit a breakpoint placed in that file.

But if I go to http://localhost:9000/register from the browser, I get 404. Maybe I need to tell it to use my routes.php file?

What is my problem?

What are the steps to debug Laravel PHP REST API from a mobile application?

1
1) "I have Xdebug installed and it's listening on port 9000." ?? Xdebug does not listen anything -- it's IDE/editor that listens for incoming debug connections as it's xdebug that makes them. 2) Where PHP is running -- same computer or VM/etc? Right now it all sounds wrong/weird (the website on 9000 port). I suggest to read/watch this first: confluence.jetbrains.com/display/PhpStorm/… and xdebug.org/docs/remote to get the proper idea of how it all works (as right now it/your setup all sounds messy to me) - LazyOne
@LazyOne PHP is running on the same computer. If not 9000, what port should I configure in the Run/Debug Configurations? - user-123
Anyone? Can someone please let me know briefly about the correct steps to debug PHP Rest API through web storm? (ports, debugger) - user-123

1 Answers

0
votes

Is there a route for /register ? Have you tried to set a breakpoint in the controller method that is called by the "/register" ? I work with Laravel and Visual Studio Code instead of PhpStorm but XDebug is the same doesn't matter which editor you use.