How To Debug PHP scripts with PhpStorm
JetBrains PhpStorm is a commercial IDE for PHP built on JetBrains’ IntelliJ IDEA platform.
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
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
Add now add as many breakpoint in your code as required.
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!