# Local-bootstrap.php is triggering a breakpoint when XDebug is enabled

**URL:** <https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229>\
**Category:** Workflow\
**Tags:** phpstorm, xdebug\
**Created:** [September 25, 2020, 4:48pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229 "2020-09-25T16:48:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hereswhatidid](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/hereswhatidid/32/4906_2.png) [@hereswhatidid](https://community.localwp.com/u/hereswhatidid)\
**Post date:** [September 25, 2020, 4:48pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/1 "2020-09-25T16:48:00Z")

</div>

I just wanted to post a solution to this issue in case anyone else is using PHPStorm and experiences it.

What’s happening is that after the latest update to Local (5.7.5+4909) there is now a file that Local is using that is outside the WP installation directory. The default debug settings for PHPStorm have an option for “Force break at first line when a script is outside the project” that is enabled. You will need to disable this option in order to stop the breakpoint from happening on every page load when using XDebug in PHPStorm in the latest version of Local.

The full path to the options in PHPStorm is:

Languages & Frameworks -\> PHP -\> Debug -\>Xdebug section

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [September 25, 2020, 7:36pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/2 "2020-09-25T19:36:44Z")

</div>

Nice callout @hereswhatidid!

For backstory, that file that is being included is so Local can make use of the new feature in WordPress core – “Site Environment Types.”

For more information about this feature and how Local implements it, see this help doc:

[https://localwp.com/help-docs/using-wp\_get\_environment\_type-to-code-for-different-environments/](https://localwp.com/help-docs/using-wp_get_environment_type-to-code-for-different-environments/)

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [September 25, 2020, 8:07pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/3 "2020-09-25T20:07:13Z")

</div>

Hi Gabe,

Thanks for providing the pointer!

Coincidentally, I ran into this as well and took a screenshot at the time. 😃

Here it is for a visual representation of what I unchecked:

 ![Screen_Shot_2020-09-23_at_10.15.34_PM](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/6/61fd0571f8edc5da9dc152c231a9d3febc1dea49.png)

I’m going to make a follow-up note to see if we can have our Xdebug Add-on handle unchecking these.

---

<div class="post-metadata">

**Author:** ![mstadelmann](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mstadelmann](https://community.localwp.com/u/mstadelmann)\
**Post date:** [September 28, 2020, 4:08pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/4 "2020-09-28T16:08:26Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![tyrann0us](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/tyrann0us/32/11751_2.png) [@tyrann0us](https://community.localwp.com/u/tyrann0us)\
**Post date:** [November 4, 2020, 8:38am UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/5 "2020-11-04T08:38:18Z")

</div>

I created an account just to say this:

Please revert defining `WP_ENVIRONMENT_TYPE`. Here are my reasons:

- As already said by @hereswhatidid, the default option in PhpStorm is to force break when a script is outside of the project. This means that all Local users have to uncheck this option on all their projects. This is not an option IMHO.
- Having a `local-bootstrap.php` set as `auto_prepend_file` will cause the file name in PhpStorms “Debug” dock to always read `local-bootstrap.php`, regardless of the actual file the breakpoint is in. See this screenshot:  
 ![Bildschirmfoto 2020-11-04 um 09.23.28](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/9/9240727b99afbebafebff20f97266869314ecbaa.png)
- It is not possible to quickly switch environments from e.g. `development` to `production` for testing purposes if you have a Composer-based setup with [WP Starter](https://github.com/wecodemore/wpstarter/tree/version-3) (which sets multiple constants based on the environment type), because `WP_ENVIRONMENT_TYPE` will _always_ be set to `local`.

If you don’t remove this, please make it at least an option (and inactive by default).  
Thanks!

BTW, if others wants to to get rid of this, simply comment out the `define( 'WP_ENVIRONMENT_TYPE', 'local' );` in `/Applications/Local.app/Contents/Resources/extraResources/local-bootstrap.php`.

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [November 9, 2020, 9:58pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/6 "2020-11-09T21:58:05Z")

</div>

Thanks for the great feedback @tyrann0us ! I’ll follow up with the Local team to see if we can get a better way of handling this!

I know that this won’t help with every new site you create, but if you are wanting to stop this behavior from happening, so that you can use WP Starter to manage the environment, you can set `auto_prepend_file` to `none` in the `php.ini.hbs` which should prevent Local from pre-pending the `bootstrap.php` file.

You’ll have to stop the site and restart it so that the handlebar file is re-compiled for the site.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [February 7, 2021, 10:12pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/7 "2021-02-07T22:12:27Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [February 26, 2021, 8:06pm UTC](https://community.localwp.com/t/local-bootstrap-php-is-triggering-a-breakpoint-when-xdebug-is-enabled/22229/8 "2021-02-26T20:06:49Z")

</div>

I know this topic is closed, but in the interest of connecting topics, there’s a feature request for moving the `WP_ENVIRONMENT_TYPE` to the `wp-config.php` file:

> **[Don't define WP\_ENVIRONMENT\_TYPE](https://community.localwp.com/t/dont-define-wp-environment-type/24587)**
>
> Issue Summary If other plugins define the constant WP\_ENVIRONMENT\_TYPE then a PHP warning is displayed as the constant is already defined. I develop plugins that allow the user to change this setting and having this define in the...
