Home  >  Article  >  Development Tools  >  An article to help you learn breakpoint debugging

An article to help you learn breakpoint debugging

咔咔
咔咔Original
2020-07-01 10:20:374429browse

It is inevitable that you will encounter unknown errors during the development process. Please specify not to debug bit by bit! This article will show you how to use atom to debug the program. If you have any If you have any questions, just reply in the comment area.

1. Install php-debug in atom

Click file->settingsAn article to help you learn breakpoint debugging Then click install and search for php-debug. If the search here cannot come up, you need to find a way! We must learn to surf the Internet scientifically! An article to help you learn breakpoint debuggingSuccessful installation is like thisAn article to help you learn breakpoint debugging

2. Download Xdebug

Download address: https://xdebug.org/download, After opening the address, you can see the extension. The one installed here is php7.3An article to help you learn breakpoint debugging, but there are two php7.3s, which one should you choose? Open your PHP environment and you can see vc15An article to help you learn breakpoint debugging in the box, then put the downloaded file into D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext, here is the address of Kaka . Just put it in your own PHP environment. An article to help you learn breakpoint debugging

3. Configuration

Then find your php.ini file and copy the following configuration Go in. Remember to modify the location of zend_extension.

This location is related to your PHP location. An article to help you learn breakpoint debugging

<span style="display: block; background: url(https://imgkr.cn-bj.ufileos.com/97e4eed2-a992-4976-acf0-ccb6fb34d308.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; letter-spacing: 0px; padding-top: 15px; background: #282c34; border-radius: 5px;">[Xdebug]<br/>zend_extension = D:\phpstudy_pro\Extensions\php\php7<span class="hljs-number" style="color: #d19a66; line-height: 26px;">.3</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">.4</span>nts\ext\php_xdebug<span class="hljs-number" style="color: #d19a66; line-height: 26px;">-2.9</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">.6</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">-7.3</span>-vc15-nts-x86_64.dll<br/>xdebug.remote_enable = On<br/>xdebug.remote_host = localhost<br/>xdebug.remote_port = <span class="hljs-number" style="color: #d19a66; line-height: 26px;">9000</span><br/>xdebug.remote_handler = dbgp<br/>xdebug.idekey=xdebug-atom<br/></code>

How to determine this location! If you are using the new version of phpstudy, D:\phpstudy_pro\Extensions\php\php7.3.4nts\extThat is this locationAn article to help you learn breakpoint debuggingIf you are using the old version of phpstudy The location is C:\phpStudy\PHPTutorial\php\php-7.1.13-nts\extAn article to help you learn breakpoint debugging

##4. Test

After completing the above work, remember to restart the environment.

Two things need to be done at this time.

First open atom debug

An article to help you learn breakpoint debugging

Second enter the address in the address bar

http://localhost/index.php?XDEBUG_SESSION_START=1Note here the following parameters.

A pop-up box will appear. Just fill in the address as your project path.

The debugging panel will come out at this time, and you can see that our variable values ​​have been printed. An article to help you learn breakpoint debuggingUp to this point our breakpoint debugging is complete. An article to help you learn breakpoint debugging

5. Summary

Summary of important steps for configuring breakpoints.

  • atom download php-debug
  • Download xdebug and put it in the corresponding PHP extension
  • You need to carry it when accessing the address bar?
  • #

The above is the detailed content of An article to help you learn breakpoint debugging. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn