avatar

Run php locally using VS Code (Windows)

How to run php locally using VS Code (Windows)

1. Install the following VS code extensions

2. Download php

https://www.php.net/downloads.php
You will find php.exe inside the downloaded folder.
php exe

3. Add php path to Windows Environment Variables setting

3.1 In Windows setting, search Environment… in the setting
3.2 In User varaibles for this account, click Path, then Edit...
3.3 In the pop up window, click New, then add the folder path of php.exe
Add php path to Windows Environment Variables setting

4. Add the php.exe path in VS code setting

In the setting.json of VS code, add the following line (change the path to your php.exe path)

Code
"php.executablePath": "C:\\Users\\username\\Desktop\\Tools\\php\\php.exe",

5. Done! You will find PHP Server: Serve project options when you right click on php file.

VS code - PHP Server: Serve project


Reference


如果您喜歡我的文章,歡迎幫我在下面按5下讚!感謝您的鼓勵和支持!

文章作者: ouoholly
文章鏈接: https://ouoholly.github.io/post/windows-run-php-using-vs-code/
版權聲明: 本博客所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。歡迎「部份引用」與介紹(如要全文轉貼請先留言詢問),轉載引用請註明來源 ouoholly 的倉庫,謝謝!

評論