Configuring the Xdebug Debug environment for Phpstorm

Source: Internet
Author: User
Tags php debug
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 currently the 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, download address: http://xdebug.org/files/php_ Xdebug-2.3.2-5.6-vc11-x86_64.dll

Configure PHP.ini

and download the Php_xdebug-2.3.2-5.6-vc11-x86_64.dll library copy 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"dbgp"xdebug.remote"req"xdebug.remote_host=127.0.0.1xdebug.remote_enable=onxdebug.remote9000xdebug.remote_autostart = no

The DLL library location downloaded above is not fixed, as long as it is precisely specified 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 native project, so this setting is the type "Local or Mounted folder"; Then specify the project path and set the URL root of the Web service

Server settings

Navigate to Languages & Frameworks > PHP > Servers configuration, add a server configuration, name customization (I use localhost here), host is localhost (native debugging), Port is set to 80,debugger select Xdebug.

After the configuration is complete, you can verify that the configuration is successful, click the "Validate Remote Environment" button in this configuration screen, select the deployment project set in the "Deployment settings" step in the Popup dialog box (SYCMS). No error message appears in the Information area of the dialog box to indicate that the servers setting is correct.

Debug settings

Locate the 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, Set DBGP as shown:

Where IDE key is the value of the Xdebug.idekey configuration item in the php.ini file.

Browser settings

To the browser installed Xdebug plug-in, I choose here is the Firefox browser and the easiest Xdebug Firefox plug-in, installed as shown below, will idekey fill in the Red box location:

Using Xdebug for debugging

Enable the Xdebug plugin in the browser
Then open the "run/debug config" configuration, a new "PHP WEB Application" Startup item, specifying the correct server and start URL to save after, as follows:

Open Xdebug Listen in Phpstorm (the "Start Listening for PHP Debug connnections" button that looks like the handset in the Boot toolbar).
Make a breakpoint and then access the address of the "Start URL" in the "run/debug config" configuration in the browser to successfully connect with Phpstorm as follows:

Problems

The first time you run Xdebug debugging, Phpstorm reported the following error:

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

Originally because the DLL file in the php.ini file is configured

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

Change it to Zend_extension to restart Apache, as shown below:

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

Resources

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

The above describes the configuration of the Xdebug debugging environment for Phpstorm, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.