• 远程调试环境配置


    一、准备工作

    1.安装vscode里面的两个扩展,php debug,remote-ssh

    2.安装对应PHP版本的xdebug

    二、ssh连接和xdebug配置

    1.ssh连接

    安装好上述的模块后,打开vscode,点击左下角的><按钮,然后选择Connect to Host

    连接成功后,打开你的项目文件夹

    同样去安装一次xdebug扩展

    安装好后点击运行与调试,创建launch.json文件,创建后会有内容,注释掉括号里面的内容

    添加如下内容,端口号可以自行修改

    "version": "0.2.0",
        "configurations": [
            {
                "name": "Debug current script in console",
                "type": "php",
                "request": "launch",
                "program": "${file}",
                "cwd": "${fileDirname}",
                "externalConsole": false,
                "port": 9004
            },
            {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9004
            }

    2.xdebug配置
    先进入/etc/php/8.1/fpm/conf.d/20-xdebug.ini

    写入内容

    这里的端口与你改的端口要一致

    zend_extension=xdebug.so
    [XDebug]
    xdebug.remote_enable = on
    xdebug.start_with_request = 1
    xdebug.mode=trace
    xdebug.collect_includes = 1
    xdebug.collect_params = 1
    xdebug.mode=debug
    xdebug.client_host=127.0.0.1
    xdebug.client_port=9004
    xdebug.start_with_request=yes
    xdebug.remote_log=/var/log/xdebug.log

    然后进入你下载PHP时自带的php.ini,我的路径在/etc/php/8.1/fpm/php.ini

    一样在最后面加入上面的内容

    重启php-fpm服务和web服务
     

  • 相关阅读:
    mfc140u.dll丢失怎么修复?4种亲测有效的方法分享
    200PLC转以太网与研华webaccess modbusTCP客户端在空调机上应用配置案例
    ITIL-4关键词汇总
    数据处理及跳转
    数据结构_绪论
    Winform DataGridView 跳转到指定数据行
    1.docker安装
    WPF-数据验证《十一》
    新加坡大带宽服务器托管优势
    C#设计模式六大原则之单一职责原则
  • 原文地址:https://blog.csdn.net/m0_62277259/article/details/132627336