vsc php 환경설정

HSGemini·2021년 6월 17일

1.

http://127.0.0.1/
xampp 설치 후 확인

xampp control panel apache 실행

주의

. C:\xampp\htdocs 안에 프로젝트 폴더 만들기

  • xampp 폴더는 설치시 위치가 다양하겠지만, 프로젝트들이 xampp\htdocs 폴더 안에 있어야 합니다.

  • 저는 test라는 프로젝트 폴더를 만들었습니다.

  • C:\xampp\htdocs\test

vsc 설정

2.

vsc > setting php > settings.json 들어가서 xampp 위치 경로 설정

{
    "php.validate.executablePath":  "C:/xampp/php/php.exe",

}

3.

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 > 크롬으로 열리도록

  • 크롬 설치 안해서 안됐음
    command: 경로는 맞는지 확인하고 알아서 수정

4.

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)

https://jaddong.tistory.com/entry/VSCode%EC%97%90%EC%84%9C-Xampp%EB%A1%9C-php-%ED%8C%8C%EC%9D%BC-%EB%B8%8C%EB%9D%BC%EC%9A%B0%EC%A0%80%EC%97%90-%EB%9D%84%EC%9A%B0%EA%B8%B0-How-to-run-php-file-in-visual-studio-code-with-xampp

profile
공부중

0개의 댓글