phpStorm used program debugging tool xdebug docker container

Premise preparation

phpstorm development software + dnmp (docker + nginx + mysql + php)

  • Mapping configured hosts such as / etc / hosts 127.0.0.1 tp5.dev
  • Php environment for existing installed xdebugextensions, after a successful installation can be output through the pages phpinfo()to see if the installation was successful xdebug
  • Installation to commissioning ieda environment, the general procedure for php developers, use phpStormmore, this article is through telling.
  • Mature dockerbuilt environment. You can use https://github.com/yeszao/dnmp

 

Configuration xdebug

[The XDebug] 
; xdebug turn support the remote debugging 
xdebug.remote_enable =. 1 
; remote debugging host, usually docker host machine, the machine is local debugging, ip inspect the container can be obtained by name docker `` 
xdebug.remote_host = 172.19.0.2 
; remote machine debugging port, generally 9000, and shown later phpStorm which is consistent 
xdebug.remote_port = 9000 
; idekey docking debugging keys, and behind phpStorm which must be consistent 
xdebug.idekey = PhpStorm 
; automatic trigger debugging this value can be set. 1; 
xdebug.remote_autostart =. 1 
; more of the parameters, refer here https://xdebug.org/docs/all_settings 
xdebug.remote_connect_back. 1 = 
xdebug.remote_handler = dbgp 
xdebug.max_nesting_level = 250
  • xdebug.remote_host can be used to view the php-fpm where the vessel ip, if it is, then you can use macdocker inspecthost.docker.internal

  • xdebug.remote_port port php-fpm with general agreement on it.

Remember to restart you configure the container docker restart 容器名称

Configuration phpStorm

Including basic configuration debug, configure several steps server, start the debug and so on.

Configuring the basis of information xdebug

Open setting-> debug configuration which follows, 9000 represents the start of the port, and the inside of the upper xdebug consistent.

 

Then setting-> server to do the following configuration, the following must be checked Use path mapping is configured, otherwise I might be able to see the debug console appears, but the situation is less than the interception phpStorm break.

Be sure to configure the use relationship path mapping mapping of local and remote directory corresponding directory.

 

Xdebug configure and start a program, edit the configuration.

Pop-up box and then click the top left of the + sign to add a PHP Remote Debug application, select the server (remoteDebug) just created above, then Session id is PHPSTORM, and above xdebug consistent remain inside. Apply and then click on the bottom right corner OK.

Finally, this red × removed.

 

 

Reference article: 

 

Guess you like

Origin www.cnblogs.com/tl542475736/p/11370416.html