How to use Xdebug with PhpStorm

preview_player
Показать описание
Debugging for WordPress using Xdebug in PhpStorm is a great way to track down hard-to-find bugs. If you’ve never had to set it up yourself, the prospect of configuring everything can be scary. With PHPStorm’s Zero Configuration guide, you can have Xdebug configured in minutes and enable step debugging, profiling, and even debugging on remote WordPress sites.

In this video, we walk you through the process of enabling Xdebug for your PHP environment, installing the debug extensions for your browser, and turning on debug connections for PhpStorm. We then look at a simple bug in a WordPress plugin and show you how to debug the problem using the tools available.

In this video, we cover:

Setting a breakpoint to pause your code once Xdebug is enabled and active
Inspecting and setting a watch on a variable that causes a bug
Stepping into the code to see how that variable changes and what causes the bug
Editing the variable mid debug to see if our assumed fix resolves the problem

Resources:

If you’re using a different editor, our latest article, How to Use Xdebug for Advanced PHP Debugging, covers various editing environments, but we focus on PhpStorm. We also cover topics like profiling and remote debugging and look at an alternative to Xdebug.

To set up and configure Xdebug in PhpStorm, Jetbrains has an excellent help doc on their website, covering everything you need. It includes the Xdebug configuration settings and the links to the browser extensions.

Finally, take a look at the Xdebug Install docs for any Xdebug specific information. With the new Xdebug 3.0 release, the way you enable Xdebug has changed slightly, so this is a great resource.

Рекомендации по теме
Комментарии
Автор

What is your run/debug configuration set up? Php web server? web page? I don't even see the option to start my php storm in debug mode(

АртёмТюльканов
Автор

Thanks for the cool video on stepping through issues and debugging in PHPStorm, will put to good use. :D

TheSoulCrisis
Автор

John, Paul and James are getting lots of mail at their gmail..

Can you post a demo like this about profiling?

superjunky
Автор

So I can't auto-connect to Phpstorm IDE without browser extension?

justinasbei
Автор

Was bored and searched for this ...
and already realize this is waste of time ... i stay with the usual way to fix bugs - read and in doubt write into a debug file.
_Debugger are all fancy tools and looks professional and shit ... but the time doing this or fixing the debugger in case its not working ... in that time i fixed the actual problem =)_

CottonInDerTube