visual studio code - How do I configure vscode live server to process php files properly (I'm using Win10 and Chrome)?
Solution:
There exist an extension to create php server directly in VSCODE
for php file
1) Once you installed the extension right click on your php
file and select the first option PHP Server: serve project
and it will open localhost link in your browser.
2) Then you need two more things. One is live-server extension and second is live-server-web-extension that needs to be installed in your browser.
3) open your php project with live server.
Press F1
and type open with live server
. It will open your php project having a port something similar to this http://127.0.0.1:5500/
copy that link.
4) Then go to your localhost
TAB and use your live-server-web-extension
and paste the link that you have just copied and be sure to enable live reload
and then Apply.
5) The last step is that you must copy your localhost
link and paste it in Actual server Address
and then again apply.
Reload your localhost
page and then you can see live change to your browser whenever you change something in your php code.
The complete video guide
Answer
Solution:
No need for an extension - the PHP CLI actually comes with a built-in webserver
Just run the following command:
php -S localhost:2222
If you really wanted to bake this into VSCode, you could add a task to execute it for you.
Source