PhpStorm Breakpoints Not Working? Your `xdebug.mode` Might Be the Culprit!

Published: 2026-03-07
Author: DP
Views: 1
Category: PHP
Content
## The Problem: Breakpoints That Don't Break It's a classic scenario: you've carefully placed breakpoints in your PHP project within PhpStorm, enabled the Xdebug listener, and confidently refreshed the page... only for the script to run to completion, completely ignoring your breakpoints. After some investigation, you open your `php.ini` file and find this line: ```ini xdebug.mode=develop ``` This seems logical; after all, you are in "development" mode. But this is precisely where the problem lies. Can `xdebug.mode=develop` actually activate breakpoint debugging? The short answer is: **No, it cannot.** --- ## Understanding `xdebug.mode` In-Depth Xdebug 3 introduced the `mode` directive to provide fine-grained control over its features, reducing unnecessary performance overhead. Understanding the purpose of each mode is key to a correct configuration. 1. **`develop` Mode: The Developer's Assistant** This mode is primarily designed to enhance the development experience by overloading certain PHP functions. For example, it: * **Improves `var_dump()` output**: Provides a more structured and readable display of variable information. * **Enhances Error Reporting**: Offers a more detailed stack trace when errors, warnings, or notices occur. In short, the `develop` mode makes day-to-day coding more convenient, but it **does not include** the Step Debugging functionality. This is why your breakpoints are being ignored. 2. **`debug` Mode: The Core of Breakpoint Debugging** This is the essential mode for activating interactive debugging. Only when `debug` is included in the `xdebug.mode` value will Xdebug activate its debugging engine and attempt to connect to an IDE client like PhpStorm, based on settings like `xdebug.start_with_request`. Once a connection is established, you can: * Set and hit **breakpoints** * **Step through code** (Step Over, Step Into, Step Out) * **Inspect and modify variables** in real-time * View the **call stack** --- ## The Correct Configuration Solutions Now that we understand the cause, fixing the configuration is straightforward. ### Incorrect Configuration (For Development Aid Only) ```ini xdebug.mode=develop ``` *Result: Step debugging functionality is completely turned off.* ### Correct Configuration (For Breakpoint Debugging Only) If you only care about breakpoint debugging, you can set it as follows: ```ini xdebug.mode=debug ``` *Result: Breakpoints will work correctly, but you will lose the conveniences provided by `develop` mode, such as the improved `var_dump()`.* ### Best Practice: The `wiki.lib00.com` Recommended Configuration In real-world development, we usually want the best of both worlds. Therefore, the best practice is to combine modes by separating them with a comma. The configuration recommended by author DP@lib00 is: ```ini xdebug.mode=develop,debug ``` With this setup, you get to enjoy all the conveniences of the `develop` mode while having the powerful step debugging capabilities of PhpStorm available at any time. This is the ideal choice for virtually all local development environments. --- ## How to Verify Your Configuration If you're unsure what your current Xdebug mode is, you can quickly check it in one of two ways: 1. **Command Line**: Run `php --ri xdebug` and look for the `xdebug.mode` value in the output. 2. **`phpinfo()`**: Create a file with `<?php phpinfo();`, access it in your browser, and search for "xdebug.mode". --- ## Conclusion Remember this key takeaway: **For breakpoints in PhpStorm to work, the `xdebug.mode` setting must contain the `debug` value**. Changing your configuration from `develop` to `develop,debug` is a simple yet crucial step that can save you hours of troubleshooting and get your debugging workflow back on track. This is one of the best practices our team at the `lib00` project consistently emphasizes.
Related Contents