Configure Xdebug debugging environment for PHPStorm

Source: Internet
Author: User
: This article describes how to configure the Xdebug debugging environment for PHPStorm. For more information about PHP tutorials, see. My Environment

  • Operating system: 64-bit win7 flagship Service Pack 1
  • PHP version: php-5.6.7-Win32-VC11-x64
  • Apache version: httpd-2.4.12-win64-VC11
  • PHPStorm version: PhpStorm 8.0.3

Download Xdebug

Xdebug official website: http://xdebug.org/
Xdebug current latest version is 2.3.2, in order to match my PHP environment, I downloaded the php_xdebug-2.3.2-5.6-vc11-x86_64.dll Library,: http://xdebug.org/files/php_xdebug-2.3.2-5.6-vc11-x86_64.dll

Configure php. ini

And copy the downloaded php_xdebug-2.3.2-5.6-vc11-x86_64.dll library to the % PHP_HOME %/ext directory, and then open the php. ini file to add the following configuration:

[XDebug]zend_extension=php_xdebug-2.3.2-5.6-vc11-x86_64.dllxdebug.idekey="PHPSTORM"xdebug.remote_handler = "dbgp"xdebug.remote_mode = "req"xdebug.remote_host=127.0.0.1xdebug.remote_enable=onxdebug.remote_port = 9000xdebug.remote_autostart = no

The location of the dll Library downloaded above is not fixed. you only need to specify the exact location in the php. ini configuration file, that is, the zend_extension configuration item points to the dll library file.

PHPStorm settings

Deployment settings

Create a project deployment entry. because I am debugging a Local project, set the type to "Local or mounted folder" here. then specify the Project path and set the URL root of the Web service.

Server settings

Go to Languages & Frameworks> PHP> Servers configuration, add a server configuration, custom Name (I use localhost here), set Host to localhost (local debugging), and set Port to 80, select Xdebug for Debugger.

After the configuration is complete, you can verify whether the configuration is successful. click "Validate remote environment" in this configuration interface, in the displayed dialog box, select the Deployment project (sycms here) set in the "Deployment settings" step. If no error message is displayed in the Information area of the dialog box, the Servers settings are correct.

Debug settings

Find Languages & Frameworks> PHP> Debug configuration and set the Debug port to 9000 (consistent with the port settings in the php. ini configuration file ).

Expand Debug and set DBGp, as shown in:

The IDE Key is the value of the xdebug. idekey configuration item in the php. ini file.

Browser settings

Install The Xdebug plug-in for The browser. here I use Firefox and The easiest Xdebug Firefox plug-in. after installation, enter The IDEKey in The red box:

Use Xdebug for debugging

Enable Xdebug plug-in the browser
Open the "Run/Debug Configuration" Configuration and a new "PHP Web Application" startup item. specify the correct Server and Start URL and save the Configuration as follows:

Open the Xdebug listener in PHPStorm (the Start Listening for PHP Debug Connnections button in the Start toolbar is like the phone receiver ).
Click the breakpoint and access the address corresponding to the "Start URL" in the "Run/Debug Configuration" Configuration in the browser to connect to PHPStorm, as shown below:

FAQs

During the first Xdebug debugging, PHPStorm reported the following error:

Cannot accept external Xdebug connection: Cannot evaluate expression'isset($_SERVER['PHP_IDE_CONFIG'])';

The reason is that the dll file configured in the php. ini file is

extension=php_xdebug-2.3.2-5.6-vc11-x86_64.dll

Change zend_extension to restart Apache, as shown below:

zend_extension=php_xdebug-2.3.2-5.6-vc11-x86_64.dll

References

Http://blog.csdn.net/dc_726/article/details/9905517
Http://www.chenxuanyi.cn/xampp-phpstorm-xdebug.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.