Phpstorm+xdebug Remote debugging server PHP code

Source: Internet
Author: User
Tags php code

Phpstorm+xdebug How to debug local code, the code should be familiar. This article is about how to debug the code for the online server. My PHP environment is lnmp1.2.

Install Xdebug

Executing on the server

PECL Install Xdebug
The Xdebug.so module will be installed.

Edit Configuration

The edit/usr/local/php/etc/php.ini adds 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 network IP
xdebug.remote_port=9000
Xdebug.remote_autostart=1
xdebug.idekey= "Phpstorm"

Execute at Terminal after change

LNMP PHP-FPM Reload

The configuration of the server ends here. Next look at the IDE's configuration.

Configuring the server

Open Settings=>languages & Frameworks=>php=>servers

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

Configure DBGP Proxy

Open Settings=>languages & FRAMEWORKS=>PHP=>DEBUG=>DBGP Proxy

Where the red box needs to be consistent with the server's xdebug configuration file.

Routing Port Mappings

Since most of our friends have routers, the native IP is the LAN IP, where the router's port needs to be mapped to local. The specific rules are as follows:

Server xdebug Port => Local port, the author here to map the router's 9000 port to the local 9000 port.

Start debugging

Open the project's run configuration and choose PHP WEB Application

The author server here is HTTPS, so added HTTPS, readers please fill in the website according to the actual situation.

Tap the IDE's "phone" icon to turn on remote monitoring.

Open code, breakpoint in diagram position

Click on the "Ladybug" icon,

Debugging can already be detected under the IDE.

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.