Debugging with XDebug, Drupal 7, PHP 7, Multi-Site setup for drupal modules

Hi all,

I've read instructions for setting up Drupal 7 and PHP 7 and I've got everything working except the debugging.  I can't get the debugging working for custom modules.

My directory structure is:

/Library/WebServer/Sites/drupal/

/Library/WebServer/Documents/drupal/sites/all/modules/MY_CUSTOM_MODULE

In PhpStorm I choose:

1. "Web server is installed locally, source files are located under its document root."

2. I choose my project folder as: /Library/WebServer/Documents/drupal/sites/all/modules/MY_CUSTOM_MODULE


I essentially follow all of the instructions at:
     a. http://blog.jetbrains.com/phpstorm/2013/07/drupal-development-using-phpstorm/
     b. http://confluence.jetbrains.com/display/PhpStorm/Drupal+Development+using+PhpStorm

PhpStorm has no problems parsing the drupal module, doing code completion for drupal, handling the drupal hooks, etc.  However, it is not doing debugging correctly.

It says "Remote file path '/Library/WebServer/Documents/drupal/index.php' is not mapped to any file path in project".  Not really sure what I'm supposed to do here, since I don't want the main drupal isntallation in my project.  I want to work on MY_CYSTOM_MODULE.

I've spent several hours searching the forums; I appreciate any insight.
2 comments

Hi there,

Xdebug is trying to debug "/Library/WebServer/Documents/drupal/index.php" (main entry) file .. which (based on your info) is outside of your project.

I guess disabling "Force break at the first line when script is outside the proejct" (Preferences | PHP | Debug) should be enough (if you not planning to have those files in your project; I just not sure of this would be enough from xdebug side when providing debug info -- I'm not sure since I'm nor Drupal user).

0

Well I found a solution, though I don't know if it's the correct solution or not.

When I start a new project in PhpStorm instead of picking my module's directory as the project directory I just pick's Drupal main root directory, /Library/WebServer/Sites/drupal/, as the project root directory.  Doing so brings the entire Drupal installation directory structure under into PhpStorm, which I guess sort of solves the problem.  Then I can go into MY_MODULE's .module file from within PhpStorm, set a breakpoint, and debug as always and everything has the expected behavior.

0

Please sign in to leave a comment.