I’ve found a more modern and easier solution partially based on CrasyCoder’s post.
The steps you need to do are the following:
- If your brand new php installation doesn’t contain php.ini, rename the php.ini-development to php.ini
- Install xdebug with help of the wizard: http://xdebug.org/wizard.php Follow its recommendations literally.
- Put in your php.ini the string: xdebug.remote_enable=1
- Go to PhpStorm’s settings: settings->php. Select or reselect directory containing php. Make sure you see ‘Debugger: Xdebug x.x.x’ string (where x.x.x stands for installed version)
- Install an extension for your favorite browser from here: http://xdebug.org/docs/remote
- From the main menu (not the settings window) go to ‘Run->Edit configurations’ and add new ‘PHP Built-in Web Server’ configuration. Point the ‘Document root’ to your project’s directory. Note the port number.
- Chrome browser: enable the extension pressing on the little bug in the rightmost side of the omnibox and selecting the Debug option. Other browsers’ extensions should work similarly.
- In PhpStorm’s menu enable the ‘Run -> Start Listen for PHP Debug connections’ option.
- Set a breakpoint in your code in PhpStorm.
- Run (not debug) the configuration you created in step 6.
- In your browser go to localhost:port where ‘port’ is the port from step 6. Your PhpStorm should stop on the breakpoint and you can start squashing bugs in your code.
Considering that:
Steps 1-5
are made once per php installation.
Step 6
is made once per PhpStorm project.
Steps 7-8
are made once per debuggin session.
Steps 9-11
are made each program run.