Introduction
If you are developing PHP using PHPStorm and IIS and need to debug it, here is what to do. PHP, IIS, PHPStorm should already be installed and configured. This is a short tutorial and I wrote it as there is none available on the net, that is:
- short,
- for windows developers, and
- complete
Step 1: Installing xDebug Extension
Download the xDebug extension for PHP from https://xdebug.org/download.php. Choose the version that is the same as the PHP version you are using.
GO to your PHP.ini and insert the following lines at the bottom of the ini file:
[XDebug]
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="C:\tmp"
Search for the extension=
entries and add:
zend_extension="C:\PHP5.6\ext\php_xdebug.dll"
Set the correct path for profile_output_dir
(some temp path) and zend_Extension
(the full path to the extension).
Step 2: Install the xDebug Browser Extension
Open the HTML browser you are using and install the xDebug add on.
For Firefox and Chrome, I'm using: XDebug Helper by Brain Gilbert.
After that, go to the Options of the extension and set its "IDEKey
" to "PHPStorm
".
Step 3: Configure IIS
Open IIS, choose your sever, go to Fast CGI Settings, double click it, double click on the PHP version you have configured. Now go to "Processmodel
" and search for Activity
timeout and Request
timeout. Set it to something useful. I set it to 600
, so you will have 10 minutes for debugging. If you do not make this setting, then you will timeout after 60 seconds.
Step 4: Connect with PHPStorm
Open PHPStorm. Open the Page you want to debug in your configured browser. In PHPStorm, click listen for PHP Debug connections Tool Button (it looks like a telephone handle). In Browser, start xDebug in Debug Mode. Now in PHPStorm, a message shows up to accept the incoming from xDebug connection. Confirm it.
If it does not come up, maybe PHPStorm is misconfigured. In its default settings, it should work flawlessly.
:-D Now you are done. Happy debugging!