Install the PHP plugin
This functionality relies on the PHP plugin, which you need to install and enable.
Press Ctrl+Alt+S to open the IDE settings and select.
Open the Marketplace tab, find the PHP plugin, and click Install (restart the IDE if prompted).
Before you start
Before you start debugging, make sure that you have a debugging engine installed and configured properly. IntelliJ IDEA supports debugging with two most popular tools: Xdebug and Zend Debugger. These tools cannot be used simultaneously because they block each other. To avoid this problem, you need to update the corresponding sections in the php.ini file as described in Configure Xdebug and Configure Zend Debugger.
Open the active php.ini file in the editor:
In the Settings dialog (Ctrl+Alt+S), click PHP under Languages & Frameworks.
On the PHP reference page that opens, click next to the CLI Interpreter field.
In the CLI Interpreters dialog that opens, the Configuration file read-only field shows the path to the active php.ini file. Click Open in Editor.
Next, install IntelliJ IDEA debugging bookmarklets or one of the Browser debugging extensions.
Listening for incoming debugger connections
In IntelliJ IDEA, enable listening to incoming debug connections by either clicking on the toolbar/the status bar or selecting Debug tool window automatically. Before launching the script, make sure that either a breakpoint is set or the Break at first line in PHP scripts option is enabled on the Debug page of the Settings dialog Ctrl+Alt+S.in the main menu. This will ensure IntelliJ IDEA reacts when a debugging session is started and opens the
Depending on your preference or application requirements, you can use the IntelliJ IDEA's built-in webserver to run our application locally, or make use of any other web server running either locally or on a remote machine.
Use the built-in web server
Use an external web server
Create a Run/Debug configuration
Do any of the following:
Select Edit Configurations on the IntelliJ IDEA toolbar
Selectfrom the main menu.
Enter the full URL to the page we want to debug on the web server. Optionally, provide some mappings so IntelliJ IDEA can determine where to find local files relative to the remote URL. This is only required when we have a different project structure locally and on the remote server. Note that if you are deploying PHP applications with IntelliJ IDEA, mappings will be reused from the deployment configuration.
Start a PHP debugging session from the browser
XDEBUG_SESSION_START=some-session-name URL parameter, for example,