I am trying to develop web pages with php
calls using vscode
and vscode live server
. I have installed live server and it works fine with html/css/js. However if the code I'm developing refers to a .php file, I just get the text of the php file, it is not executed by the server. I did find live-server-web-extensions
which installs into the chrome browser, presumably to do a reload when the php files are modified as well.
So what I need to know is: How do I configure the server to process php files? I do have php.exe on my system, and if I used the php browser, things work fine. But I'd like to use vscode and live server for development, and I'm missing the secret sauce. I'm am using the Chrome browser and Windows 10.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With