PHP

XAMPP를 사용하여 Visual Studio Code에서 PHP 파일 실행

민이뭘라이프 2022. 8. 14. 22:53

1. XAMPP 다운로드 받아 설치하기

참고 포스트 https://annajang.tistory.com/12

 

[XAMPP] 윈도우에 설치하기 (on windows)

▶ XAMPP란? - XAMPP의 이름은 X(크로스 플램폼), A(아파치 웹 서버), M(MariaDB), P(PHP), P(Perl) 의 줄임말이다. - XAMPP는 PHP 개발 환경에 가장 인기 있고 오프라인 환경인 로컬PC(=개인이 소유하고 있는..

annajang.tistory.com


2. XAMPP 하위에 프로젝트 폴더 만들기

  • 기본적으로 XAMPP가 설치된 경로에서, C:\xampp\htdocs 폴더 안에 프로젝트 폴더를 만든다.
  • 예를들어 study라는 프로젝트라면 C:\xampp\htdocs 폴더 아래에 study라는 폴더를 만든다.
    • C:\xampp\htdocs\study

3. 빌드 환경 구축하기

  • VSCode 메뉴바에서 [터미널(Terminal)] > [기본 빌드 작업 수행(Configure Default Build Task ..] > [템플릿에서 tasks.json 파일 만들기] 선택하고, MS build, maven, .Net Core, Other 옵션 중 아무거나 선택한 후 자동으로 생성된 코드를 다음과 같이 수정하고 저장한다.
{
    // 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}"
    ],
    "group": {
        "kind": "build",
        "isDefault": true
    }
}