Reputation: 1226
I have a problem with Xdebug, like everything installed correctly, I put a breakpoint, but nothing happens, i.e. despite the breakpoint, the debugger doesn't stop.
My /etc/php/7.4/apache2/conf.d/20-xdebug.ini config
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0o
When I execute php -v
i got:
PHP 7.4.6 (cli) (built: May 14 2020 10:03:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
with Xdebug v2.9.5, Copyright (c) 2002-2020, by Derick Rethans
My PhpStorm settings:
I set breakpoint in PhpStorm:
I'm writing a REST API suing Symfony 4 and using Postman to send a request and would like to debug the code.
Any idea? How can I debug my REST API?
Upvotes: 0
Views: 3684
Reputation: 1352
Configure PHPStorm XDebug to trigger on RESTful API requests
Add new PHP Remote Debug configuration
Add in php.ini
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.idekey=PHPSTORM
And now you only need to start the debugger with Xdebug configuration.
Upvotes: 2
Reputation: 856
XDEBUg is not dependent on a PHP framework whether it runs or not.
I see a "0o". Set it to 1. Although the apache shouldn't start with "0o".
xdebug.remote_autostart = 0o
This is my XDEBUG configuration, but in the docker.
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_port=9000
# xdebug.remote_host=${IP} # docker
You still have:
xdebug.idekey = PHPSTORM
Try calling the endpoint with ?XDEBUG_SESSION_START=PHPSTORM
Set the check mark at Run -> Break at first line in PHP Script. This way you can see if XDEBUG reacts at all.
Then please configure your application under: Run -> Edit Configurations -> Templates -> PHP Remote Debug
Upvotes: 2