This Article explains you how to configure your PHPStorm to work with your local installation of Drupal and debug using XDebug.
If you would like to know how install Drupal or Acquia drupal or XDebug please refer to the hundreds of articles already published.
For full documentation on using PHPStorm and Drupal, refer to the JetBrains documentation.
- Download trial PHPstorm http://www.jetbrains.com/phpstorm/
Create a Project
It is assumed you already have a full Drupal environment which includes: Apache, MySQL, PHP, Drupal and XDebug
So as a result we have two assumptions:
- your local drupal site is at http://mylocalsite (usually its http://localhost);
- your local drupal code is at c:\path\to\my\local\code
which is also the DocumentRoot for mylocalsite vhost config in Apache.
So here is what you need to do:
- File --> New Project from Existing Files
- choose Web Server is installed locally, source files are located under its document root --> Next
- enter the path your local Drupal code c:\path\to\my\local\code
- Local Server:
- Name: your project name should be fine
- Web server root URL: should be http://mylocalsite:[port]
- Web path for project root: leave blank. In Drupal projects the web path is the same as the path to the source code --> Finish
Enable Drupal support
PhpStorm has built in support for things like autocompletion, syntax highlighting, Drush, integration with the Drupal.org issue queue, and more. Read about how to enable and configure it in the official PhpStorm documentation.
Set Up a Server
So it should look something like this:
Now place some breakpoints and click on Debug (Shift + F9)
- Run --> Edit Configurations
- click on the yellow plus button --> PHP Web Application
- Name: your project's name
- click on the button
- Name: your server name (any name)
- Host: mylocalsite (without the http://)
- Port: your mylocalsite port
- Debugger: Xdebug
- click OK
- in Server choose the server you just created
- Browser: your favorite browser where the site will be open
- Click OK