In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use phpstorm to debug the script in docker, it has certain reference value, interested friends can refer to it, I hope you can learn a lot after reading this article, let the editor take you to know about it.
When debug the environment running in the container, you can debug through web pages and scripts.
Here's how to debug the scripts in the container.
Understand the principle of xdebug.
Xdebug is an extension of php that collects information executed by php and then sends it to the remote ip+port of the instruction. Usually the development tools we use here listen to a certain port. Received the php execution message. Then display it in the debug interface.
First of all, the php environment in the container needs to have the xdebug extension installed and configured, where the corresponding image name is php_sk.
This is the running container, / etc/docker/daemon.josn is configured to access the docker using api (to enable phpstorm to access the container)
Because it is a test environment, there is no access control.
The virtual machine is installed in VirtualBox, and the network is in NAT mode, which communicates internally through port forwarding.
By forwarding port 2375, the browser can access api
Set the debug port. Default is 9000.
Configure docker access parameters in phpstorm
At this point, you can see the container in the virtual machine, which can be started, paused, and accessed.
Select php version, and command line access mode, select docker, and find the image corresponding to php.
Configure the corresponding directory and set the name, which will be used to execute the script later
Configure debug, because it is a command line to execute the script, select php script
Connect to the virtual machine, execute the script (/ home/www/sk/html/index.php), and replace the ip with the ip of the host where the phpstorm resides
The copy code is as follows:
Docker run-rm-v / home/www:/home/www-env "XDEBUG_CONFIG=remote_host=10.249.22.204 remote_port=9010"-env "PHP_IDE_CONFIG=serverName=new" php_sk php / home/www/sk/html/index.php
As you can see, the script can be debug already
Thank you for reading this article carefully. I hope the article "how to use phpstorm to debug scripts in docker" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.