This section provides a handful selection of tutorials that will help you get started with PHP debugging in PhpStorm.
Quick Start
Older versions of PHPStorm will not work with newer versions of XDebug. A common error you'll run into is breakpoints only working on index.php and not being able to step over or into code. Finally, make sure the version of XDebug you're using is compatible with the version of PHP you're running. For instance, PHP 7.3 and 7.4 use XDebug 2.9. XAMPP is a software package that bundles in a single package PHP + Apache + MySQL + phpMyAdmin + some other tools for PHP Web development in Windows environment. Part I: Installing XAMPP and Configuring the Apache Server and MySQL Database This first part will show you how to install XAMPP, start the Apache server, and create your first MySQL DB. XAMPP, Xdebug and phpStorm. Ask Question Asked 7 years, 7 months ago. Active 7 years, 7 months ago. Viewed 3k times 1. I'm having a heck of a time getting xdebug working on xampp. I'm trying to be able to debug php in the browser with phpStorm. I'm on Windows 7 (64bit edition).
Release date: 2021-04-08. Linux, macOS: source; Windows binaries: PHP 7.2 VC15 (64 bit) PHP 7.2 VC15 (32 bit) PHP 7.2 VC15 TS (64 bit) PHP 7.2 VC15 TS (32 bit) PHP 7.3 VC15 (64 bit) PHP 7.3 VC15 (32 bit) PHP 7.3 VC15 TS (64 bit) PHP 7.3 VC15 TS (32 bit) PHP 7.4 VC15 (64 bit). Xdebug: A powerful debugger for PHP. This setting controls which Xdebug features are enabled. This setting can only be set in php.ini or files like 99-xdebug.ini that are read when a PHP process starts (directly, or through php-fpm), but not in.htaccess and.user.ini files, which are read per-request. The following values are accepted.
Before proceeding with any of the debugging scenarios, you need to choose a debugging engine and install it in your PHP environment. These tutorials will guide you through the installation process:
With the debugging engine installed, you can start debugging by following the zero-configuration debugging approach:
Choose and install the browser extension suitable for your browser.
On the PhpStorm toolbar, toggle to start listening for incoming PHP debug connections, or choose Run | Start Listening for PHP Debug Connections from the main menu.
Set a breakpoint in your code. Breakpoints can be set in the PHP context inside PHP, HTML, TWIG, BLADE, and files of other types. Line breakpoints can be set only on executable lines, but not on comments, declarations, or empty lines. For details on getting started with Twig and Blade debugging, refer to Debug Twig templates and Debug Blade templates.
Start the debugging session in the browser using the installed browser extension.
During a debugging session, examine the program state: see variable values, evaluate expressions, step through the program, and so on.
See Zero-configuration debugging for the detailed step-by-step instructions, and Advanced debugging scenarios for more debugging scenarios.
Debugging a PHP web application
Depending on your environment, you can debug your PHP Web application locally or remotely.
Local debugging | Remote debugging |
---|---|
The debugging engine and PhpStorm are running on the same machine. | The debugging engine is running on a remote environment (for example, a remote server or a virtual machine). |
Follow the Zero-configuration debugging procedure. |
|
To test direct connection, run the telnet host 9000
(for Xdebug) or the telnet host 10137
(for Zend Debugger) command on the remote server and ensure that connection is established. Here, host
is the IP address of the local machine PhpStorm is running on.
To check for opened inbound ports, you can use canyouseeme.org or a similar service.
Debugging a PHP CLI script
Depending on your environment, you can debug your PHP CLI script locally or remotely.
Phpstorm Xdebug Xampp Mac
Local debugging | Remote debugging |
---|---|
The debugging engine and PhpStorm are running on the same machine. | The debugging engine is running on a remote environment (for example, a remote server or a virtual machine). |
Follow the Debug a PHP CLI script procedure. |
|
Besides running an entire application, you may want to run a PHPUnit or Behat test that covers a specific class, function or scenario, with the debugging engine attached. To learn how to do it, follow the Create a test configuration for a specific target procedure.
Phpstorm Xampp Debugging
Troubleshooting
When using Xdebug or Zend Debugger with PhpStorm, some misconfiguration can prevent the debugger from working. In the Troubleshooting guide, you will find the description of some common issues and learn how to troubleshoot them.
Advanced debugging scenarios
Phpstorm Setup Xdebug
The following topics will assist you in exploring the advanced debugging scenarios in PhpStorm: