Home > php教程 > PHP源码 > body text

phpstorm xdebug remote debugging server PHP code

WBOY
Release: 2016-07-06 13:34:26
Original
1659 people have browsed it

xdebug can debug the error code lines and error code details when a program error occurs. Let's take a look at a tutorial on phpstorm xdebug remote debugging server PHP code. The details are as follows.

How to debug local code with phpstorm xdebug, you should be familiar with the code. This article talks about how to debug the code of an online server. My PHP environment is lnmp1.2.

Install xdebug

Execute on the server


pecl install xdebug

The xdebug.so module will be installed.

Edit Configuration

Edit /usr/local/php/etc/php.ini and add the following code at the end:


[Xdebug]
zend_extension="xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=Your local public IP
xdebug.remote_port=9000
xdebug.remote_autostart=1

xdebug.idekey="PHPSTORM"

Execute in the terminal after the changes are completed

lnmp php-fpm reload

The server configuration ends here. Next, look at the IDE configuration.

Configure Server

Open Settings=>Languages ​​& Frameworks=>PHP=>Servers

The information in the red box is the information of the online server.

Configure DBGp Proxy

Open Settings=>Languages ​​& Frameworks=>PHP=>Debug=>DBGp Proxy

The red box needs to be consistent with the xdebug configuration file of the server.

Routing port mapping

Since most friend companies have routers, the local IP is the LAN IP, and the router’s port needs to be mapped locally. The specific rules are as follows:

Server Xdebug port => Local port. Here, the author maps the router's 9000 port to the local 9000 port.

Start debugging

Open the project's run configuration and select "PHP Web Application"

The author’s server here is https, so I added https. Readers, please fill in the URL according to the actual situation.

Click the "Phone" icon of the IDE to enable remote monitoring.

Open the code and breakpoint at the location shown in the picture

Click on the "Ladybug" icon,

Debugging can already be detected below the IDE.

<script>ec(2);</script>
Related labels:
source:php.cn
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template