douyunhuan9886 2019-06-20 23:25
浏览 133

调试PHP应用程序时,Visual Studio代码没有启动浏览器[wordpress]

I am running on: Ubuntu v18.04.1 Visual Studio Code v1.35.1 PHP v7.2.19-0ubuntu0.18.04.1 xdebug v2.7.2 wordpress v5.2.1

I am trying to debug WordPress with visual studio code and its working, when I launch a debug session by pressing F5it works, it stops at the break-points.

The problem is instead of launching a browser, vscode shows all the page source in the debug console and then ends the debug session.

Screenshot of the first few lines of Page Source on Debug Console

launch.json has the following options configured

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "program":"${workspaceRoot}/index.php",
            "pathMappings": {
                "/var/www/html/wordpress": "${workspaceRoot}"
            }

        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

Thankyou for reading this question. I would appreciate any help

  • 写回答

1条回答 默认 最新

  • dtx6087 2019-06-21 00:41
    关注

    1st I am not sure if it helps but i think your error in :

    "program":"${workspaceRoot}/index.php",
    "pathMappings": {
    "/var/www/html/wordpress": "${workspaceRoot}" }

    is your wordpress folder inside html folder? html folder is default folder come with linux when you install apache, what about switching program and pathMapping place? like

    "pathMappings": {  
       "/var/www/html/wordpress": "${workspaceRoot}"  
    }
    "program":"${workspaceRoot}/index.php",  
    

    this may be off topic but i suggest you to use gulp with browserSync it very cool and if you used it once you will use it always trust me

    this link will help you start it in 1 hour you wont regret it if you know what gulp can do even for wordpress it automate everything in short and much more if you go in depth in it more than vscode

    BTW you can do the BrowserSync only and leave the rest
    but its better to watch the whole video so you dont get error then modify it for your needs

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划