> 记录PHPSTROM + PHPDEBUG 调试线上项目。 * 线上系统 Centos 7 * 本地环境 Mac OS Bigsur * 线上环境 PHP7.1 ## 线上环境配置 ### PHPDEBUG扩展 * 项目目录下新建phpinfo(); 文件; * 快速查找符合自己的phpxdebug插件: [https://xdebug.org/wizard]() * 复制phpinfo的源代码粘贴到输入框,点击:Analyse my phpinfo() output 按钮。  * 它会教你怎么操作的。 * 以下是PHP7.1的PHP.ini 配置文。 ```php [XDebug] ; 如果大家要配置这个的话,可以模仿一下下面的规则,去对应的版本目录下找到对应的 xdebug.so 文件即可 zend_extension=/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so ; 开启远程调试功能 xdebug.remote_enable=1 ; 远程调试地址 xdebug.remote_host=localhost ; 远程调试端口 xdebug.remote_port=9001 ; 每次执行脚本都会启动 xdebug 调试 xdebug.remote_autostart = 1 ; debug 调试的日志位置 xdebug.remote_log = /tmp/xdebug.log ``` ### 端口转发 * 本地终端运行 > 作用:端口转发到本地好调试,云服务器要到服务器安全组放行9001端口。 ```shell ssh root@您的服务器地址 -R 您的服务器地址 :9001:127.0.0.1:9001 ``` ### 本地PHPSTROM * 设置调试端口为配置的9001  ## 完成  最后修改:2021 年 06 月 21 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏