LoginSignup
1

More than 1 year has passed since last update.

posted at

dockerでの環境構築時に出てきた、PHP message: Xdebug: [Log Files] File '/tmp/xdebug.log' could not be opened.PHP message: Xdebug: [Step Debug] Could not connect to debugging client. の解決方法

皆様こんにちは。
先日入社した会社でdockerを用いた開発環境の構築を行なっていたのですが、その際にエラーが出て詰まってしまったので、備忘録を兼ねて記事を書こうと思います。

エラー文

PHP message: Xdebug: [Log Files] File '/tmp/xdebug.log' could not be opened.PHP message: Xdebug: [Step Debug] Could not connect to debugging client

エラー文の意味

/tmp/xdebug.logが開けず、Xdebugがdebug出来ていない。

解決策

project直下に、launch.jsonを用意する。

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": ポート番号(デフォルトは9000番),
        "pathMappings": {
          "/var/www": "${workspaceFolder}/www" // Dockerのドキュメントルート:ローカルのドキュメントルート
        }
      }
    ]
  }

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
1