27

I've setup Xdebug with the following configuration:

[xdebug]
zend_extension="/usr/local/Cellar/php55-xdebug/2.2.5/xdebug.so"
xdebug.remote_enable= "On"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.remote_autostart = "Off"
xdebug.profiler_enable = "On"
xdebug.profiler_output_dir = "/tmp"
xdebug.idekey="PHPSTORM"

and using "remote debugging" with the Xdebug toggler plugin for safari.

But in PHPStorm it always breaks on the first line even though I have no breakpoint set there. I have looked in the settings of and found a setting related to this. But I have unchecked those. But even after a restart it still breaks on the first line of the first file.

PHPStorm settings

How can I disable this behaviour?

Matthijn
  • 3,126
  • 9
  • 46
  • 69

7 Answers7

51

Run | Break at first line in PHP scripts -- try turning it ON and OFF few times. Sometimes it is get stuck in between: showing OFF but in reality it is ON.

If this solves your issue .. then -- http://youtrack.jetbrains.com/issue/WI-17389 -- star/vote/comment to get notified on progress. This particular moment has been fixed since PhpStorm v9.


If you still having such issue (IDE breaks an first line) and the above does not help ... then it has nothing to do with this option/answer and it's some misconfiguration at another place (missing or wrong paths mappings and stuff like that).

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 2
    That indeed was the problem. It was ticked even though the checkmark was not visible. – Matthijn Sep 17 '14 at 18:22
  • 1
    Thank you! I didn't have a problem with it turning on/off just the fact that this setting does not exist inside the actual debugger settings - just randomly in this menu – aknosis Feb 10 '16 at 17:52
21

You can find the option in Run menu, it's at the bottom. enter image description here

Hieu Vo
  • 3,105
  • 30
  • 31
6

And my solution was to uncheck

  • Force break at first line when no path mapping specified
  • Force break at first line when a script is outside the project

under Settings > Languages & Frameworks > PHP > Debug (see also).


enter image description here

Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
5

For those who are stil having the problem, I solved mine by editing the file:

.idea/workspace.xml

and looked for the PhpDebugGeneral component and manually entered "false" to the xdebug flags there.

<component name="PhpDebugGeneral" break_at_first_line="false" ...

It looks like some leftover from the upgrade in my project.

Supra
  • 1,612
  • 1
  • 18
  • 36
user3389934
  • 51
  • 1
  • 4
  • 1
    Seemed promising, but there is no such entry in my `workspace.xml` file. PHPStorm 2016.2.2. – fracz Oct 29 '16 at 21:08
3

All the above didn't work. The problem in my case was: The file which has the first line was in a directory which was excluded. This is why it sayd: The script ..path-to-script/index.php is outside the project. Even though it is not.

If you click on Click to set up mappings and then toggle the directory from File Directory on local machine you will see the directory which is Excluded is not listed here.

The fix was to un-exclude the directory having the file with the first line. And exclude all contents inside. You can easily do this with right clicking on the directory > Mark Directory as > Cancel Exlusion and the same to exclude the other content inside right click > Mark Directory as > Excluded

enter image description here

caramba
  • 21,963
  • 19
  • 86
  • 127
1

for me the problem was a wrong path mapping make sure that the directory of your project is opened in the IDE

Hassan
  • 407
  • 5
  • 22
  • This was the problem for me too. If you've tried all the checkboxes above there is a good chance that this is the cause. In PHPStorm the settings are under Settings -> Languages & Frameworks -> PHP -> Servers – user3640967 Dec 04 '19 at 12:37
0

In my case, I tried these steps:

  • step 1: uncheck these two options at xdebug section

enter image description here

  • step 2: copy & paste the directory of your project at /xampp/htdocs/{your-project}

enter image description here

Omid Erfanmanesh
  • 547
  • 1
  • 7
  • 29