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.