How do I enable the PHP debugger?

To enable PHP debugging, you must have PHP installed on your computer and you must also have xDebug extension added to your PHP setup.

Recommended Solution (beginner friendly)

To save time, you can use self-installing and self-configuring PHP and xDebug package. Click here to download it. After installing this package, make sure, the code editor is fully allowed in your firewall settings. Next time when you launch the editor, you should be able to set breakpoints and execute PHP scripts.

Advanced Solution

Step 1 - Download and install PHP

To run PHP scripts, you need the PHP interpreter installed. Visit www.php.net and download the latest PHP x.x.x zip package (not the installer) from the Windows Binaries section. After downloading the zip file, extract PHP to some convenient folder. Please note that architecture and whether it is a thread safe package matters. E.g., if you download 64bit VS16 Non Thread Safe version, you will need the very same version of the xDebug files.

Step 2 - Download xDebug extension

Go to www.xdebug.org and download xDebug Windows module for the PHP version you installed in the previous step. For example, if you have PHP 8.3.2 64bit VS16 Non Thread Safe installed, you need the xDebug for PHP 8.3.2 64bit VS16 Non Thread Safe. Alternatively, you can use xDebug Installation Wizard.

Step 3 - Add xDebug to PHP

Copy the downloaded xDebug DLL file in the folder containing other PHP extensions, for example, C:\php8\ext When this is done, locate and open php.ini file. If there is no such file, locate php.ini-dist and rename it to php.ini. At the end of this file add the following lines:


[Zend]

zend_extension = C:\php8\ext\php_xdebug.dll

xdebug.mode = debug

xdebug.start_with_request = trigger

xdebug.client_port = 9000

Replace C:\php8\ext\php_xdebug.dll with the full path to your xDebug dll file.

Step 4 - Configure the code editor

On the Options menu, click Preferences and locate PHP Options. There you must specify the path to php.exe file which can be found in the folder where you installed the PHP.

Step 5 - Avoid possible problems

Make sure, the code editor is fully allowed in your firewall settings and then restart the program. Next time when you launch the editor, you should be able to set breakpoints and execute PHP scripts.