Configuring Zend Debugger
On this page:
- Downloading and installing Zend Debugger
- Enabling Zend Debugger integration with the PHP engine
- Integrating Zend Debugger with PhpStorm
- Configuring Zend Debugger for using in the On-Demand mode
Downloading and installing Zend Debugger
- Download the Zend Debugger package which corresponds to your operating system.
- Locate the
ZendDebugger.so
(Unix) orZendDebugger.dll
(Windows) file in the directory which corresponds to your version of PHP (e.g. 4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x, 5.3.x, 5.4.x). - Copy the file to your Web server in a location that is accessible by the Web server.
Enabling Zend Debugger integration with the PHP engine
- Open the active
php.ini
file in the editor:- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for OS X, and click PHP under Languages&Frameworks.
-
On the PHP page that opens, click
next to the Interpreter field.
-
In the Interpreters dialog box 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: -
To enable access to Zend Debugger from PhpStorm, 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_host 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:
Open the page that corresponds to the file in the browser. The output should contain a Zend Debugger section.
<?php phpinfo(); ?>
Integrating Zend Debugger with PhpStorm
- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for OS X, and click PHP under Languages&Frameworks.
-
Check the Zend Debugger installation associated with the selected PHP interpreter:
-
On the PHP page, choose the relevant PHP installation from the Interpreter drop-down list
and click the Browse button
next to the field. The list shows all the PHP installations available in PhpStorm, see Enabling PHP Support.
- The Interpreters dialog box that opens shows the following:
Learn more about checking the Zend Debugger installation in Validating the Configuration of a Debugging Engine.
-
On the PHP page, choose the relevant PHP installation from the Interpreter drop-down list
and click the Browse button
- 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 text box, appoint the port for PhpStorm to communicate with the tool through.
Type the port number within the tunnel specified in the
php.ini
file throughzend_debugger.tunnel_min_port
andzend_debugger.tunnel_max_port
. For details, see http://files.zend.com/help/previous-version/Zend-Server-4-Community-Edition/zenddebugger.html - To have PhpStorm accept any incoming connections from Zend Debugger engines through the port specified in the Debug port text box, select the Can accept external connections check box.
- 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 text box.
- In the Debug Port text box, appoint the port for PhpStorm to communicate with the tool through.
Type the port number within the tunnel specified in the
-
In the External Connections area,
specify how you want PhpStorm to treat connections received from hosts and through ports that are not registered as server configurations.
- Ignore external connections through unregistered server configurations: Select this check box to have PhpStorm ignore connections received from hosts and through ports that are not registered as server configurations. When this check box is selected, PhpStorm does not attempt to create a server configuration automatically.
-
Detect path mappings from deployment configurations:
- When this check box is selected, PhpStorm attempts to retrieve path mappings for debugging in a remote environment from the server access configuration (deployment configuration).
- When the check box is cleared, you have to specify the path mappings manually.
- Break at first line in PHP scripts: Select this check box to have the debugger stop as soon as connection between it and PhpStorm is established (instead of running automatically until the first breakpoint is reached). Alternatively turn on the option on 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 PhpStorm debugger too often, select the Ignore Z-Ray system requests check box.
Configuring Zend Debugger for using in the On-Demand mode
Starting with version 2016.2, PhpStorm 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:
- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for OS X, and click PHP under Languages&Frameworks.
-
From the PHP executable drop-down list, choose the relevant PHP interpreter and click
next to it. In the Interpreters dialog box that opens, click the Open in Editor link next to the Configuration file: <path to php.ini> file. Close all the dialog boxes 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: Linux and OS X:Windows:zend_extension=<full_path_to_ZendDebugger.so>
Windows non-thread safe:zend_extension_ts=<full_path_to_ZendDebugger.dll>
zend_extension=<full_path_to_ZendDebugger.dll>
-
Open the Interpreters dialog box and click
next to the PHP executable field. PhpStorm informs you that debugger is not installed:
-
To enable PhpStorm to activate Zend Debugger when it is necessary, specify the path to it in the Debugger extension text box,
in the Additional area. Type the path manually or click
and select the location in the dialog box that opens.