http://127.0.0.1/
xampp 설치 후 확인
xampp control panel apache 실행
. C:\xampp\htdocs 안에 프로젝트 폴더 만들기
xampp 폴더는 설치시 위치가 다양하겠지만, 프로젝트들이 xampp\htdocs 폴더 안에 있어야 합니다.
저는 test라는 프로젝트 폴더를 만들었습니다.
C:\xampp\htdocs\test
vsc > setting php > settings.json 들어가서 xampp 위치 경로 설정
{
"php.validate.executablePath": "C:/xampp/php/php.exe",
}
ctrl + shift + b -> 생성 tasks.json 에서
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "chrome",
"windows": {
"command": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
},
"args": ["localhost\\${workspaceRootFolderName}\\${fileBasename}"]
}
ctrl shift b > 크롬으로 열리도록
index php 작성해서
<?php
$var="hello";
$output = $var. "world";
echo $output;
?>
참고
VSCode에서 Xampp로 php 파일 브라우저에 띄우기 : How to run php file in visual studio code with xampp (tistory.com)