Phpstorm method for local breakpoint debugging

Source: Internet
Author: User
Tags phpinfo
PHP code in debugging, often print_r or var_dump to breakpoints, but when the project is more complex, so the efficiency is very low, breakpoint debugging is very good to solve the problem, this article mainly introduces the Phpstorm local breakpoint debugging method steps, Interested in the small partners can refer to


PHP code in debugging, often print_r or var_dump to breakpoints, but when the project is more complex, so the efficiency is very low, breakpoint debugging is very good to solve the problem. You may not be comfortable with breakpoint debugging at first, but when you get used to it, the more you use it.

Note: The following are the Windows7+apache environment

First, breakpoints debugging PHP environment construction

1, check whether the local PHP environment installed Xdebug

On-Premises output phpinfo (); Search xdebug;

If not installed, the installation operation Xdebug as follows:

Enter the Phpinfo () information in the URL: box, get the appropriate Xdebug version, follow the operation.

2, after installing the Xdebug, configure the local php.ini. Add the configuration as follows, if you want to add additional xdebug configurations, you can view the Xdebug configuration in phpinfo and add it yourself as appropriate.

[xdebug];zend_extension values are filled in according to their local environment zend_extension = "D:/idemix442_jcp/php-5.5.27-win32-vc11-x64/ext/php_ Xdebug-2.2.5-5.5-vc11-x86_64.dll "xdebug.idekey=phpstormxdebug.remote_enable = onxdebug.remote_host=localhost; The default value for Xdebug.remote_port is 9000, which needs to be consistent with the Phpstorm configuration, as described below _trace = On

3, then configure Phpstorm, where the debug port is not occupied by other applications, when the program cannot enter the breakpoint, you can consider whether other applications occupy your local port 9000.

4. Install the xdebug extension to your Chrom browser

Xdebug Download Address://

After the download, unzip, choose one of the versions, installed in your Chrom browser (directly into the browser extension can be), I test the 360 speed browser is also possible. After the installation is complete, there will be a reptile-like thing in the top-right corner of the browser, such as.

Second, start your breakpoint debugging

1. In the browser where you installed the Xdebug extension, open a page of your local project. and turn on debug in the top right corner of the browser, such as.

2. In your phpstorm editor, open the code you want to pass through the page in your browser and press the action.

3. Once again, refresh the page you opened in the browser and look at your phpstorm editor. The red circle on the left breakpoint turns into a tick in the circle, so you go to the breakpoint. Such as

Third, the breakpoint debugging some simple operation

1. Check the value of some variables before you place your breakpoint

Double-click the variable you want to see, and the mouse hovers over it, and the value appears. Or click the right mouse button to select Add to watch (English version is add to watch), such as

2, from the point where you start the breakpoint, you can press F7, the program will step-by-step down, hit the function, will jump to the function, press F8 is in the current code page line down, hit the function will not jump. These two functions are the most practical and critical functions of breakpoint debugging.

3, when you want to jump directly from a breakpoint to another line breakpoint, you can enter the breakpoint, when you want to another line breakpoint, click on the breakpoint, and then press F9 or click the green button in the bottom border, such as.

4, when you because of breakpoint debugging, in a number of breakpoints, and open more than one file, want to see you in those places breakpoints, you can press Ctrl+shift+f8 to browse breakpoints

5, breakpoint debugging There are a lot of tips, you can slowly find in the use of groping.

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: 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.