Debugging with Xdebug

Setting Up Xdebug with Nitro and PhpStorm

For this video we are going to learn how to set up Xdebug with PhpStorm running a local server on Craft Nitro.

For this video we are going to learn how to set up Xde­bug with Php­Storm run­ning a local serv­er on Craft Nitro. Xde­bug runs on the serv­er, as a PHP exten­sion, so the first we need to do is enable Xde­bug in our Dock­er con­tain­er that is man­aged by Craft Nitro.

For­tu­nate­ly, Craft Nitro already has sup­port for Xde­bug and a sim­ple com­mand we run run to tog­gle Xde­bug on and off.

$ nitro xon

Nitro com­mands like xon are con­text-aware, so if you’re not in a project direc­to­ry that Nitro rec­og­nizes, then it will ask you to choose for which site you want to enable Xde­bug. If you are in a project direc­to­ry, then it will enable it for that project.

This enables Xde­bug so it is run­ning as a PHP exten­sion. Now it will be avail­able to call back to our IDE on port 9000 when it receives a HTTP request.

Debugging with Xdebug is made up of the following videos: