映射xdebug端口
docker run -p 8200:80 -p 9003:9003 -d --rm -it unzipper
或者docker-compose 映射端口 9003为调试端口
安装xdebug
docker build -t unzipper .
apt-get updateapt-get install php-xdebug
编辑vim /etc/php/7.4/fpm/php.ini
如果是xdebug2
[xdebug]zend_extension="/usr/lib/php/20190902/xdebug.so"xdebug.remote_enable=1xdebug.remote_autostart=1xdebug.remote_host=192.168.75.1xdebug.remote_port=10000
如果是xdebug3
[xdebug]zend_extension = "/usr/lib/php/20190902/xdebug.so"xdebug.log = /usr/local/php/xdebug.logxdebug.mode = debugxdebug.start_with_request = yesxdebug.client_port = 10000xdebug.client_host = 192.168.75.1xdebug.remote_handler = dbgpxdebug.idekey = PHPSTORMxdebug.cli_color = 2xdebug.var_display_max_depth = 15xdebug.var_display_max_data = 2048
注意 host是phpstorm所在机器的ip
设置请求时间
默认配置的话,如果我们编辑器一直处于 Debug 状态,这个时候浏览器访问的网站就会超时出现 502 的错误,这是因为我们 PHP Debug 的时间太长了,浏览器因为服务器挂掉了,所以我们需要配置一下,增加 PHP Debug 的等待时间,下面以宝塔面板自带的 PHP 7.3 版本为例,只需要编辑如下文件:
vim /www/server/php/73/etc/php-fpm.conf
修改 request_terminate_timeout时间为 0 即可:
request_terminate_timeout = 0
那么就可以愉快的 Debug 审计了。
重启php-fpm
pkill php-fpm/usr/sbin/php-fpm7.4

添加调试端口就能调了,要是不能加个服务器 见另一篇nginx配置学习

