Home > Backend Development > PHP Tutorial > PHP Xdebug + PhpStorm debugging remote server code

PHP Xdebug + PhpStorm debugging remote server code

藏色散人
Release: 2023-04-06 11:36:01
forward
6927 people have browsed it

1. Server (linux centos) install xdebug

pecl install xdebug
Copy after login

Note that after the installation is completed, the path to debug.so will be displayed and record it

2. Configure php.ini
If you don’t know where php.ini is, you can search it

find / -name "php.ini"
Copy after login

Add xdebug configuration

zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"xdebug.remote_enable = 1xdebug.remote_host = 使用PhpStorm的那个机器的公网ip,可在(https://ip.cn/)查xdebug.remote_connect_back = 1xdebug.remote_port = 9001xdebug.idekey="PHPSTORM"
Copy after login

Restart php-fpm.

3. Use phpinfo(); to verify whether the xdebug extension is installed successfully. If the installation is successful, you can see the following picture

##4. Set the debug port, which is consistent with the 2. configuration (xdebug.remote_port)

5. Set Servers in PhpStorm

6. Set up DBGp proxy

7. Install the Chrome xdebug extension (may open a proxy) to facilitate remote debugging.

https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc
Copy after login
8. After installing the xdebug extension, right-click the picture of the bug

and click option

Select the IDE key as PhpStorm, click Save

9. Left-click

, select Debug, and open debug Switch (you may need to open the page that needs to be debugged first)

It will turn green after opening the bug

10. Open PhpStorm's monitoring (upper right corner)

## 11. Break the point, open the page, and see the picture below, enjoy!

PS: Debug related default shortcut keys:

F8 - Step over. Continue to execute the program after the breakpoint, execute line by line, execute one line at a time

F7 - step. Enter the content program executed at the breakpoint

ALT F9 - Run to the cursor
F9 Continue to execute the program after the breakpoint and stop at the next breakpoint

The above is the detailed content of PHP Xdebug + PhpStorm debugging remote server code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template