Joshua's Cheatsheets
Light
help

PHP - Cheatsheet

Debugging

XDebug

XDebug is the best solution. Usually all it takes to enable is to download the matching DLL (use this tool to find matching version) and place in extension folder. Then add these lines to php.ini config file (example):

zend_extension=xdebug-2.7.2-7.2-vc15-x86_64
xdebug.remote_enable=1
xdebug.remote_autostart=1

In VSCode, this is usually the config I use in launch.json for debugging:

{
	"name": "Listen for XDebug",
	"type": "php",
	"request": "launch",
	"port": 9000
}

Warning: Adding XDebug will usually add some additional load time in your local environment

Manually triggering XDebug

Aside from adding breakpoints, you can also trigger your IDE debugger manually (similar to JavaScript debugger; kw), by using xdebug_break() (details). Just make sure to not have in production code!!!

Markdown Source Last Updated:
Mon Nov 04 2019 04:08:01 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Mon Aug 19 2019 17:06:24 GMT+0000 (Coordinated Universal Time)