VSCode에서 PHP를 단계별로 실행하기 위한 세 단계(로컬 버전 + VM 환경 버전)
6744 단어 PHPVirtualBoxxdebugvmwareVSCode
2020/05/17
launch.json
에 pathMappings 예를 추가오늘도 내일도 내일도 VSCode가 될 것입니다 😎
목표
다음 경우에 단계를 수행할 수 있는 작업
PHP, Web サーバ, ソースコード, Vscode
PHP, Web サーバ, ソースコード
VScode

쓰지 않는 것
절차
0. (디버깅 대상이 VM에 있는 경우에만) 게스트 OS 소스 코드를 호스트에서 볼 수 있도록 합니다.
C:/app/src/wwwroot
를 공유 폴더로 설정확장
PHP Debug
설치shift + ctrl + x
에 php debug
입력
디버그 구성 파일 만들기

/.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug PHP",
"type": "php",
"request": "launch",
"port": 9000,
// 以下、デバッグ対象がVM上にある場合のみ書く
"pathMappings": {
// ゲストOSのソースの場所 : VSCode のあるホストOSから見えるゲストOS上のソースの場所
// e.g. いずれかひとつでOK
// "C:/app/src/wwwroot" : "//guest-hostname/wwwroot"
// "C:/app/src/wwwroot" : "//192.168.100.101/wwwroot"
// "C:/app/src/wwwroot" : "${workspaceRoot}"
}
}
]
}
Xdebug
설치
ⅰ.
php -i
결과 (전부)를 htps : // x로 부는 g. 오 rg / 우자 rd
ⅱ. DLL 다운로드

ⅲ.
php.ini
와 같은 계층에 ext
폴더를 만들어 거기에 다운로드했다 DLL
를 둔다ⅳ. Xdebug 설정
/php.ini
; ローカルのみで環境をつくってる場合
zend_extension = php_xdebug-2.9.5-7.4-vc15-x86_64.dll
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host=localhost
; - - -
; デバッグ対象がVM上にある場合
zend_extension = php_xdebug-2.9.5-7.4-vc15-x86_64.dll
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
; ゲストOSから見たホストOSのIP
xdebug.remote_host=192.168.100.101
ⅴ. 웹 서버 재시작
단계 실행
「브레이크 모드」가 되는 것을 확인할 수 있으면 OK.
여담입니다만 브레이크 모드로
php.ini
하고 ctrl + alt + w
만큼 떼어 놓고 w
로 선택하고 있는 식을 워치식에 추가할 수 있네요. 이 근처 Visual Studio의 바로 가기 체계에 전해 줘서 고맙습니다 😊참고
Documentation - all settings: htps : // x로 부는 g. 오 rg / 두 cs / 아 l_ 세친 gs
Reference
이 문제에 관하여(VSCode에서 PHP를 단계별로 실행하기 위한 세 단계(로컬 버전 + VM 환경 버전)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/hykisk/items/15bc4937286b6cb92757텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)