Skip to content

Instantly share code, notes, and snippets.

@nimzo6689
Last active January 11, 2019 06:54
Show Gist options
  • Save nimzo6689/5547d00b5f0fa03ff63d9814c465792d to your computer and use it in GitHub Desktop.
Save nimzo6689/5547d00b5f0fa03ff63d9814c465792d to your computer and use it in GitHub Desktop.
Scoop + VS CodeでPHPのデバッグ環境を構築する手順
# 参考
# https://www.peyarogu.com/entry/php_xampp_vscode
# Scoop, VS Codeはインストール済みを想定
scoop php php-xdebug apache composer
@'
{
"require": {
"felixfbecker/language-server": "*"
}
}
@' | Out-File -Encoding UTF8 ~\scoop\persist\composer\home\composer.json
composer global update
@'
extension=php_mbstring.dll
extension=php_openssl.dll
extension=pdo_sqlite
[Date]
date.timezone = Asia/Tokyo
[mbstring]
mbstring.language = Japanese
mbstring.encoding_translation = Off
mbstring.detect_order = auto
mbstring.substitute_character = none
@' | Out-File -Encoding UTF8 ~\scoop\persist\php\cli\conf.d\custom.ini
@'
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
@' | Out-File -Encoding UTF8 -Append ~\scoop\persist\php\cli\conf.d\xdebug.ini
mkdir php-sample-project
cd php-sample-project
@'
{
"php.validate.executablePath": "D:\\xampp\\php\\php-win.exe",
"php.executablePath": "D:\\xampp\\php\\php-win.exe",
"php.suggest.basic": false
}
'@ | Out-File -Encoding UTF8 .vscode\launch.json
@'
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"pathMappings": {
"${env:USERPROFILE}\\scoop\\persist\\apache\\htdocs": "${workspaceFolder}"
},
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
'@ | Out-File -Encoding UTF8 .vscode\launch.json
# PATHにPHP dirを追加
vscode .
# cp -Recurse * -Exclude .vscode "$(scoop which httpd | split-path)\..\htdocs"
httpd
# Ctrl + C で終了
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment