【Xdebug 3.0】 VSCode + PHPDebug で Vagrant + VirtualBox 上のプロジェクトをデバッグ
環境
仮想環境
- Vagrant + VirtualBox
- CentOS7
- PHP 7.2
- XDebug 3.0.1
ホスト環境
- MacOS Catalina
- VSCode
- PHPDebug → https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug
共有フォルダにプロジェクトが入っています。
何か
検索すればいろいろ出てくるVSCode + PHPDebugの利用方法ですが、最近XDebug3.0がリリースされ、元の状態ではデバッグできなくなってしまいました。。
いろいろ調べて、できた一例を載せます。
一例
仮想環境内
/etc/php.d/15-xdebug.ini
2行目 zend_extension=xdebug.so
84行目 xdebug.client_host = "10.0.2.2"
102行目 xdebug.client_port = 9003
788行目 xdebug.mode = debug,develop
974行目 xdebug.start_with_request = yes
PHPDebug設定
.vscode/launch.json
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"log": true,
"pathMappings": {
"path/to/project" : "${workspaceRoot}", //左側は仮想マシン内のプロジェクトのパス
},
"runtimeArgs" : [
"-d", "xdebug.start_with_request=yes",
"-d", "xdebug.mode=debug,develop",
]
}
]
}
参考になるサイトはこちら
Author And Source
この問題について(【Xdebug 3.0】 VSCode + PHPDebug で Vagrant + VirtualBox 上のプロジェクトをデバッグ), 我々は、より多くの情報をここで見つけました https://qiita.com/monjara/items/1303ecdf781ebf74968b著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .