Xdebug Support
Xdebug is a popular general debugging extension for PHP. As a PHP extension, it needs to be installed in DevKinsta’s FPM container, which provides PHP. Starting with DevKinsta 2.8.0, Xdebug is included with the FPM Docker image for DevKinsta.
Finding Your IP Address
In order to make the necessary changes to configure Xdebug with your site in DevKinsta, one of the things you’ll need is your IP address.
Mac
ifconfig -l | xargs -n1 ipconfig getifaddr
If that doesn’t return your IP address, try the following:
ipconfig getifaddr en0
or
ipconfig getifaddr en1
Windows
Run this command in WSL:
grep nameserver /etc/resolv.conf | cut -d ' ' -f2
Linux
hostname -I | cut -d ' ' -f1
Configure Xdebug With DevKinsta
- Open DevKinsta and navigate to the Site configurations screen for the site where you want to enable Xdebug.
- Scroll down to PHP.ini Editor, add the following, replacing <youripaddress> with your actual IP address, and click the Save changes button:
xdebug.client_host = <youripaddress>
Configure Xdebug With Your IDE or Editor
In your preferred IDE or code editor, open your site and edit your debugging configuration.
In this example, we’re using Visual Studio Code (aka VS Code), so we’ll edit the launch.json file and configure the path to our site. Replace SITE_NAME with the actual folder name of your site.
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/www/kinsta/public/SITE_NAME": "${workspaceRoot}"
}
}
Breakpoints should now work, and you can begin debugging with your IDE or editor.