Phpstorm Local Breakpoint debugging

Source: Internet
Author: User
Tags phpinfo

Objective:
PHP code in debugging, often print_r or var_dump to break, but when the project is more complex circumstances, so the efficiency is very low, breakpoint debugging is very good to solve the problem. At first it may not be suitable for breakpoint debugging, but when used, the more comfortable it becomes.

Note: The following is in the Windows7+apache environment one, breakpoint debugging PHP Environment build

1, to detect whether the local PHP environment installed Xdebug
In the local output phpinfo (); Search xdebug;

If not installed, the installation operation Xdebug as follows:
Phpinfo (), the information of all input URL: http://xdebug.org/wizard.php box, get the appropriate xdebug version, according to the operation of the following figure.

2. After installing the Xdebug, configure the local php.ini. Add configuration as follows, if you need to add additional xdebug configuration, you can view the Xdebug configuration in Phpinfo, add 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=phpstorm
xdebug.remote_enable = on
xdebug.remote_ The
default value of Host=localhost Xdebug.remote_port is 9000, which needs to be consistent with the Phpstorm configuration, as explained below
xdebug.remote_port=9000
XDEBUG.REMOTE_HANDLER=DBGP
xdebug.auto_trace = On

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

4, to your Chrom browser installation xdebug extension
Xdebug Download Address (CSDN does not have 0 integration options): http://download.csdn.net/download/qq_21386275/9995790
After downloading, decompression, select one version, installed in your Chrom browser (directly drag into the browser extension on it), my own test 360 speed browser is also OK. After the installation is complete, a crawler-like object appears in the upper-right corner of the browser, as shown below.
Second, start your breakpoint debugging

1, in your installation has been Xdebug extended browser, open a page of your local project. and turn on debug in the upper-right corner of the browser, as shown below.

2. In your phpstorm editor, open the code you want to pass through in your browser, and follow the instructions in the image below.

3, refresh the page you opened in the browser again, and then look at your phpstorm editor. The red circle on the left breakpoint turns into a circle with a pair of hooks, then represents you into the breakpoint. The following figure
Three, the breakpoint debugging some simple operation

1, look at the location of your breakpoint before the value of some variables
Double-click the variable you want to view, and the mouse hovers over it, and the value appears. or select and click the right mouse button, select Add to Monitor (English version is add to watch), the following figure

2, from the beginning of your breakpoint, you can press F7, the program will step down, touch the function, will jump to the function, press F8 is in the current line of code page down, hit the function will not jump. These two features are the most practical and critical features of breakpoint debugging.

3, when you want to jump directly from a breakpoint to another line at the breakpoint, you can enter the breakpoint, when you want to at another line breakpoint, click on the breakpoint, and then press F9 or click on the lower border of the green button, the following figure.

4, when you due to breakpoint debugging, at multiple breakpoints, and opened a number of files, want to see where you are in those places breakpoints, you can press Ctrl+shift+f8 to browse the breakpoint

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

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.