Configuring PHPStorm

Last updated on
14 November 2017


This Article explains to 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 to 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.

Installing PHPStorm

  1. Download trial 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 it's 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 Existing 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 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:

That's 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

Related Articles:

  2. Configuring Xdebug with phpstorm