Debugging with PhpStorm: Xdebug starter guide

preview_player
Показать описание
Build a solid foundation for diving deeper into the nuanced world of debugging in PhpStorm. In this episode, you’ll learn about starting a debugging session, breakpoints, and stepping over and into code with Xdebug.

#php #jetbrains #phpstorm #tutorial #phpdebugging #learnphpstorm
Рекомендации по теме
Комментарии
Автор

Bro! I can't believe how easy that was! I used the debugger when I started with Java and have been frustrated with the lack of a debugger ever since switching to PHP. Thank you! A debugger is a critical tool to use. It's like having the ability to use the dd() function anywhere, anytime, on every line, even! Just use the step buttons. Wonderful.

davidh
Автор

This is Perfect for debugging the flow of your code, but when it comes to seeing variables contents dd() work like magic.

saydfuad
Автор

Xdebug is the second best debugger for PHP. Pair echo 'test'; and var_dump($variable) is first

cichy
Автор

i usee phpstorm xdebug in my local docker and couldnt live without it. Love it. I also use with my remote GCP VM's container, but it only works sporadically. i set breakpoints on the local file, then turn on the remote's debuger in PS. one week it works and the next week it can't catch a breakpoint. the chrome extension is active. its maddening. It would be great if you made a best practices video for remote PS xdebug with troubleshooting.

rpbale
Автор

Xdebug is one of the first things I get working in a new environment. It's also great for TDD, writing tests and stepping through the code and inspecting variables to check if things are as expected. I hardly ever use echo, vardump or DD anymore, direct access to all variables values is much better than having to write dump (dumb) lines.

The auto install is new to me, does this work for docker containers as well?

I had a lot of issues with laravel sail and the scan for interpreter freezing phpstorm in v2024.2.3. it doesn't seem to like the xdebug env vars in docker-compose. Getting xdebug working for web requests, cli and unit tests with docker can be quite challenging, esp. in combination with windows/wsl and how and where local files are stored in mapped drive into wsl Vs unc Vs local drive.

Even though it's a challenge, I've found it always paid dividends in the long run.

imqqmi
Автор

Would be awesome if you could show how to debug a Laravel project while it’s running. I’m trying to debug a controller action, but PhpStorm won’t stop at the breakpoint — no idea why. I’m used to RubyMine, which makes it super easy, but PhpStorm feels kinda different

thevocoder
Автор

It would be great if you went through every little button of the debugger. I am sure I am not using it as it is supposed. For example... where are you supposed to write down the statements you want to evaluate in real time once you stop the program? In vscode you have a list that stays there between runs.

eduardpertinez
Автор

It looks like this does not work for OSX. Do you have other directions for OSX?

rcharamella
Автор

trying to debug a php script that handles email messaging, but the validation, & all that stuff is on another page. The script is hit only after everything passes, & php storm is not hitting the break when i try to listen for the post. If it is, then i'm probably not familiar with the whole debuging ways, & appearances in phpstorm. Been programming since 1988, & is fully aware of what debugging is, & how to wait for calls, & stuff, but am very new to PHP storm, & also not a master of PHP, but have used it over the years. Just enough knowledge to get by, not mastered it, like I am in ASP, or any of the .NET technologies. Just want to see someone catch a PHP post call. I just can't seem to trigger the debugging breakpoint on the PHP Email sending function. I set breakpoint, & the function stops instantly, with no post sent to it, then exits when I continue. Just can't seem to listen for the call. It just stops on the breakpoint immediately, then exits when you press continue. Not triggered by a post from the other page. Only runs immediately with no post. Can't seem to figure out how to listen for the post. With my limited knowledge of PhpStorm, it seems to not be a true environment debugger. It is possible that my PHP version, & XDebug versions are not compatible. Some talk about zlib... *_PHP version 7.4.13, & 8.0.0 is not supported on Windows due to missing exported symbols in zlib, upgrade to at least 7.4.20, or 8.0.7._*

rdmpnx
Автор

Now with docker and make it toggle-able please

supportic
welcome to shbcf.ru