Local environment Phpstorm+xdebug Configuration and breakpoint debugging

Source: Internet
Author: User

Installation environment: Xampp;phpstorm; Windows 7 64bit.

XAMPP, Phpstorm are directly installed in the D-Packing directory, 9999m directory built under D:\xampp\htocts, that is, Directory Engineering folder path for D:\xampp\htocts\9999m. In Phpstorm>file>open, find 9999m, click OK, load 9999m to Phpstorm (the installation environment path changes as needed, and the following configuration content is similar).

1. Start server-side configuration: Install good XAMPP, stop Apache Service (note that if you exit the XAMPP directly, it will not stop Apache).

2. Find php.ini in the installation directory, similar to D:\xampp\php\php.ini, and open.

3. Find the Annotated item (remove the front.) ) and set as follows:

[XDebug]

============== Original Code

Xdebug.profiler_append = 0
xdebug.profiler_enable = 1
Xdebug.profiler_enable_trigger = 0
Xdebug.profiler_output_dir = "D:\phpStudy\tmp\xdebug"
Xdebug.trace_output_dir = "D:\phpStudy\tmp\xdebug"
Xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
Xdebug.remote_handler = "DBGP"
Xdebug.remote_host = "127.0.0.1"
; zend_extension= "D:\phpStudy\php53n\ext\xdebug.dll"

After ============== changed

Xdebug.profiler_append = 0
xdebug.profiler_enable = 1
Xdebug.profiler_enable_trigger = 0
Xdebug.profiler_output_dir = "D:\phpStudy\tmp\xdebug"
Xdebug.trace_output_dir = "D:\phpStudy\tmp\xdebug"
Xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
Xdebug.remote_handler = "DBGP"
Xdebug.remote_host = "127.0.0.1"
zend_extension= "D:\phpStudy\php53n\ext\xdebug.dll"
xdebug.idekey= Phpstrom

==================== reproduced the

Zend_extension = "D:\xampp\php\ext\php_xdebug.dll"

Xdebug.profiler_append = 0

xdebug.profiler_enable = 1

Xdebug.profiler_enable_trigger = 0

Xdebug.profiler_output_dir = "D:\xampp\tmp"

Xdebug.profiler_output_name = "cachegrind.out.%t-%s"

Xdebug.remote_enable = On

Xdebug.remote_handler = "DBGP"

Xdebug.remote_host = "127.0.0.1"

Xdebug.trace_output_dir = "D:\xampp\tmp"

xdebug.idekey= Phpstrom

The initial setting is this: Figure 2

The meaning is to be commented out, so first remove;

Then open xdebug.remote_enable = on;

But also to increase xdebug.idekey= phpstrom.

Where remote_host refers to the debugging of the client's address, that is, the IDE's IP, the same remote_port is the client's port, the two in the context of remote debugging to change, when the remote eventually changed to:

[XDebug]

Zend_extension = "D:\xampp\php\ext\php_xdebug.dll"

Xdebug.profiler_append = 0

xdebug.profiler_enable = 1

Xdebug.profiler_enable_trigger = 0

Xdebug.profiler_output_dir = "D:\xampp\tmp"

Xdebug.profiler_output_name = "cachegrind.out.%t-%s"

xdebug.remote_enable = 1

Xdebug.remote_handler = "DBGP"

Xdebug.remote_mode = "req"

Xdebug.remote_port = 9000

4. Save the file and restart the Apache check to see if the Xdebug service has been successfully opened.

One way to enter D:\xampp\php\php.exe-m in CMD is to see Xdebug, which indicates the successful opening of Xdebug.

Another way for the browser to open localhost, find phpinfo () Click to open the configuration, look for xdebug items, found a description xdebug configuration success.

At this point, the server-side configuration is complete.

5. The following is client-side debugging. Open Phpstorm, enter file>settings>php (file-settings-language and frame-php), interpreter Browse, fill D:\xampp\php\php.exe, and automatically identify the version.

6. Enter File>settings>php>servers, here to fill in the server-side information, name fill localhost,

, the host fill localhost,port fill 80,debugger select Xdebug. Figure 7 is a custom virtual domain name.

7. Enter File>settings>php>debug, see Xdebug tab, Port Fill 9000, other default. Figure 8

8. Enter FILE>SETTINGS>PHP>DEBUG>DBGP proxy,ide key fill phpstorm,host fill Localhost,port Fill 9000, click OK exit settings. Figure 9

9. Enter run> Debug configurations, point + number, server optional Localhost,start URL is on the basis of http://localhost plus go, such as add 9999m, on the formation of Http://loc alhost/9999m.

Take the blue address as a reference, Browse to fill in the Chrome, click OK to exit the setting. Figure 10

Click OK to exit the setting, the Phpstorm Run button is automatically populated next to the localhost, and the Run button is activated from gray to green. If the start URL is filled with http://localhost, no 9999m is filled in, then when the Phpstorm Run button is clicked, the browser goes to the default address http://localhost, there is no way to directly access http://localhost/9999m.

Chrome browser link configuration. Find the corresponding plugin, chrome for Phpstrom IDE Support chrome.crx, download it yourself and drag the file to the Chrome setup > Extender program.

  

A JB icon is added to the top right corner of Chrome to successfully install the plugin.

11. Open listening in the Phpstorm, is a phone like the button, click into Green, click before the program code point, set the program segment point, click the Green Debug Crawler button, the Chrome browser opens Xdebug page, Phpstorm appears the Debug window, And get to the variables value, that is, to see the following debug information, which indicates a successful configuration. Figure 13

12 Breakpoint Debugging

Set and remove breakpoints by clicking the position in the red box

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.