7

I want to try to work with PHPStorm Debug.

I already installed debug on my Mac and changed the php.ini File. Furthermore, I installed the Debug Helper for Chrome and created a Projekt on PHPStorm.

If I start Debug, my PHPStorm will find a connection, but I had the Problem that PHPStorm always jumps into my "index.php" file no matter where I set my breakpoint.

I always have to push the "play" button, but again, it runs always through the "index.php" file and my site (I work with VM) will not load before I push "play".

What do I have to do so PHPStorm only jumps to my breakpoint?

Updated

Attached my PHPStorm Settings:

My PHP Settings

I have a VM Project so i add the Drupal Path, in my Projekt "htdocs"

Next my Debugging Configurations

PHPUnit

I run a test successfully

My Debugger always run into index.php without any breakpoints

  • I vote to close as this question relates to PHP debugging with a particular IDE and server setup which can be asked on stackexchange.com. It really has nothing to do with Drupal. – J. Reynolds Mar 21 '16 at 5:23
  • I disagree. The question is very specific to using PHPStorm to develop a Drupal module, which is different than using PHPStorm to develop a generic web application. The latter is much easier to setup, while the former requires Drupal-specific settings changes to PHPStorm. I think it is more likely to find an answer on Drupal Answers rather than StackExchange. – mradcliffe Mar 21 '16 at 15:53
  • @mradcliffe I use PHPStorm exclusively for PHP development and that's not my experience - you need the same settings for any application that dispatches everything through index.php don't you? What's the Drupal-specific bit? (will gladly re-open this BTW, but like the others I didn't know there were Drupal-specific debug settings) – Clive Mar 21 '16 at 16:25
  • I guess I thought it was a bit more specific to Drupal than most projects because the project is the module and core isn't in the project root. I see the question SE probably having to delve into Drupal web root specifics in order to be solved (my answer below is generic, but isn't working for the user atm). But I guess if it's off-topic, it's off-topic. shrug – mradcliffe Mar 21 '16 at 17:13
  • Sounds good to me @mradcliffe, re-opening – Clive Mar 21 '16 at 18:05
4

Relevant for PHPStorm 10:

Disable the Force break at the first line when a script is outside the project setting. This is accessible under Settings:

Languages & Frameworks > PHP > Debug > Xdebug

I also disable Force break at the first line when no path mappings specified.

  • It's 99% this. I always have to set the path mapping when using a VM so it doesn't pop open index.php. – Kevin Mar 20 '16 at 18:01
  • i already try but my index.php still popup.. what do you mean with "path mapping"? – weristsam Mar 21 '16 at 17:13
  • Does PHP Storm run on the host or the VM guest machine? If on the host then you will need to do path mapping. If on the VM guest itself then there is no need for that. – J. Reynolds Mar 22 '16 at 7:10
0

In addition to @mradcliffe's answer above, and as you work in a VM I guess you may have your browser open in the host OS, hence you need to enable these settings in php.ini (and assuming you use xdebug):

zend_extension="..path to xdebug extension/ext/php_xdebug.dll"

xdebug.remote_enable=1

xdebug.remote_port="9000"

You furthermore need to set the IDE key to PHPStorm in your chosen debug extension in the browser. You can also consult the PHP Storm documentation to set it up as an environment variable if you wish, or you can add a bookmarklet.

And just to cover all the bases, you need to listen for incoming connections in PHP Storm here:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.