Configure Zend Debugger
Install the PHP plugin
This functionality relies on the PHP plugin, which you need to install and enable.
Press Control+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).
Download and install Zend Debugger
Download the Zend Debugger package which corresponds to your operating system.
Locate the ZendDebugger.so (Unix) or ZendDebugger.dll (Windows) file in the directory that corresponds to your version of PHP (for example php-7.0.x).
Copy the file to your Web server in a location that is accessible by the Web server.
Enable Zend Debugger integration with the PHP interpreter
Open the active php.ini file in the editor:
In the Settings dialog (Control+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.
Locate or create the
[Zend]
section.To load the Zend Debugger extension, add one of the following lines inside the
[Zend]
section depending on your operating system:zend_extension=<full_path_to_ZendDebugger.so>zend_extension=<full_path_to_ZendDebugger.dll>To enable access to Zend Debugger from IntelliJ IDEA, add the following lines:
zend_extension=<full_path_to_zend_debugger_extension> zend_debugger.allow_hosts=127.0.0.1 zend_debugger.expose_remotely=allowed_hosts zend_debugger.tunnel_min_port=<any integer value above 1024> zend_debugger.tunnel_max_port=<any integer value below 65535>The value of the
zend_debugger.allow_hosts
parameter is the IPs of your machine to connect to the server debugger. It could be a comma-separated list of IPs in the formatX.X.X.X
(for example, 192.168.0.6).Restart your Web server.
To check that the Zend Debugger has been installed and configured correctly, create a file with the following contents:
<?php phpinfo();Open the page that corresponds to the file in the browser. The output should contain a Zend Debugger section.
Integrate Zend Debugger with IntelliJ IDEA
Press Control+Alt+S to open the IDE settings and select
.Check the Zend Debugger installation associated with the selected PHP interpreter:
On the PHP page, choose the relevant PHP installation from the CLI Interpreter list and click next to the field. The list shows all the PHP installations available in IntelliJ IDEA, see Configuring Local PHP Interpreters and Configuring Remote PHP Interpreters.
The CLI Interpreters dialog that opens shows the following:
The version of the selected PHP installation.
The name and version of the debugging engine associated with the selected PHP installation (Xdebug or Zend Debugger). If no debugger is configured, IntelliJ IDEA shows the corresponding message:
Learn more about checking the Zend Debugger installation in Validate the configuration of a debugging engine.
Define the Zend Debugger behaviour. Click Debug under the PHP node. On the Debug page that opens, specify the following settings in the Zend Debugger area:
In the Debug Port field, appoint the port for IntelliJ IDEA to communicate with the tool through. Type the port number within the tunnel specified in the php.ini file through
zend_debugger.tunnel_min_port
andzend_debugger.tunnel_max_port
. For details, see Zend Debugger - Configuration DirectivesTo have IntelliJ IDEA accept any incoming connections from Zend Debugger engines through the port specified in the Debug port field, select the Can accept external connections checkbox.
To use a debugger toolbar in the browser, specify the port through which the debugger settings are passed to the browser in the Settings broadcasting port field.
Use the Automatically detect IDE IP checkbox to enable and disable auto-detection of hot IP addresses. When this checkbox is selected, IntelliJ IDEA detects all the host IP addresses to be sent to Zend Debugger through the
debug_host
parameter. All the detected IP addresses are listed in the field to the right. Auto-detection of IP address is helpful when you use Vagrant, or VirtualBox, or other virtualization tool.Clear the checkbox to block auto-detection of host IP addresses and specify the required ones explicitly in the field.
In the External Connections area, specify how you want IntelliJ IDEA to treat connections received from hosts and through ports that are not registered as deployment server configurations.
Ignore external connections through unregistered server configurations: select this checkbox to have IntelliJ IDEA ignore connections received from hosts and through ports that are not registered as deployment server configurations. When this checkbox is selected, IntelliJ IDEA does not attempt to create a deployment server configuration automatically.
Break at first line in PHP scripts: select this checkbox to have the debugger stop as soon as connection between it and IntelliJ IDEA is established (instead of running automatically until the first breakpoint is reached). Alternatively turn on the option from the main menu.
Max. simultaneous connections: use this spin box to limit the number of external connections that can be processed simultaneously.
To block requests from the Z-Ray system if they annoy you by invoking the IntelliJ IDEA debugger too often, select the Ignore Z-Ray system requests checkbox.
Configure Zend Debugger for using in the On-Demand mode
IntelliJ IDEA supports the On-Demand mode, where you can disable Zend Debugger for your global PHP installation and have it enabled automatically on demand only when you are debugging your command-line scripts or when you need code coverage reports. This lets your command line scripts (including Composer and unit tests) run much faster.
Disable Zend Debugger for command-line scripts:
In the Settings dialog (Control+Alt+S), go to PHP under Languages & Frameworks.
From the PHP executable list, choose the relevant PHP interpreter and click next to it. In the CLI Interpreters dialog that opens, click the Open in Editor link next to the Configuration file: <path to php.ini> file. Close all the dialogs and switch to the tab where the php.ini file is opened.
In the php.ini file, find the
[Zend]
section and comment the following lines in it by adding;
in preposition:;zend_extension=<full_path_to_ZendDebugger.so>;zend_extension=<full_path_to_ZendDebugger.dll>Open the CLI Interpreters dialog and click next to the PHP executable field. IntelliJ IDEA informs you that debugger is not installed:
To enable IntelliJ IDEA to activate Zend Debugger when it is necessary, specify the path to it in the Debugger extension field, in the Additional area. Type the path manually or click and select the location in the dialog that opens.