Configuring PHPStorm

Last updated on
3 November 2016

Overview

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.

Installing PHPStorm

  1. Download trial PHPstorm http://www.jetbrains.com/phpstorm/
  2. Install...

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:

  1. File --> New Project from Exisiting Files
  2. choose Web Server is installed locally, source files are located under its document root --> Next
  3. enter the path your local Drupal code c:\path\to\my\local\code
  4. 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:

Thats it!

Now place some breakpoints and click on Debug (Shift + F9)

  1. Run --> Edit Configurations
  2. click on the yellow plus button --> PHP Web Application
  3. Name: your project's name
  4. Server:
    1. click on the button
    2. Name: your server name (any name)
    3. Host: mylocalsite (without the http://)
    4. Port: your mylocalsite port
    5. Debugger: Xdebug
    6. click OK
  5. in Server choose the server you just created
  6. Browser: your favorite browser where the site will be open
  7. Click OK