Select Page

How To Debug PHP scripts with PhpStorm

How To Debug PHP scripts with PhpStorm
| php


JetBrains PhpStorm is a commercial IDE for PHP built on JetBrains’ IntelliJ IDEA platform.

PhpStorm provides intelligent editor for PHP code, HTML and #JavaScript with on-the-fly code analysis and automated refactoring for PHP and #JavaScript code. Code completion supports PHP 5.3 including namespaces and closures.

Edit php.ini, located at /xampp/php/php.ini if you use XAMPP

Turn the following properties

implicit_flush = On  ; xdebug.remote_enable  ; Type: boolean, Default value: 0  ; This switch controls whether Xdebug should try to contact a debug client which is listening on the  ; host and port as set with the settings xdebug.remote_host and xdebug.remote_port. If a connection  ; can not be established the script will just continue as if this setting was Off.  xdebug.remote_enable = 1  ; xdebug.remote_handler  ; Type: string, Default value: dbgp  ; Can be either 'php3' which selects the old PHP 3 style debugger output, 'gdb' which enables the GDB  ; like debugger interface or 'dbgp' - the brand new debugger protocol. The DBGp protocol is more  ; widely supported by clients. See more information in the introduction for Remote Debugging.  xdebug.remote_handler = "dbgp"  ; xdebug.remote_host  ; Type: string, Default value: localhost  ; Selects the host where the debug client is running, you can either use a host name or an IP  ; address.  xdebug.remote_host = "localhost"  ; xdebug.remote_port  ; Type: integer, Default value: 9000  ; The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the  ; client and the bundled debugclient. As many clients use this port number, it is best to leave this  ; setting unchanged.  xdebug.remote_port = 9000

Restart Apache by using XAMPP control panel. Xdebug should now be correctly configured, You can check this installation by using the online installation check page here


Start PhpStorm and under settings, add a new server if it is not already done

Then check that you use the default port for Xdebug


You should now be read to debug your PHP scripts, start the zero configuration feature of PhpStorm by clicking the phone to make it green. PhpStorm is now listening to incoming debug connections.



Add now add as many breakpoint in your code as required.

Visit this page: bookmarklets generator , you’ll have to save these bookmark to start/stop a debugging session by controlling the Xdebug cookie.

Now every time you want to debug a page, all you have to do is to use one of these bookmarks!


Enjoy debugging sessions with ease!

About The Author

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology.In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions.I'm the Founder and CEO of Disruptr GmbH.