-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP downloading instead of executing #3
Comments
Ok Ok! I got you! You're on wrong track! Can I know the actual address of you PHP project when you're not using Live Server? eg: If I assume this => Now, open VSCODE. setup settings "liveServer.settings.proxy": {
"enable": true,
"baseUri": "/",
"proxyUri": "http://localhost:80/php/"
},
"liveServer.settings.CustomBrowser": "firefox", (assume if if Hopefully, you got it |
Sorry, still don't get it with that baseUri, does that mean I still have to keep my project files in /var/www? |
Ok! Let me know what is your actual PHP URL ..!!! BTW, set baseUri as |
Hi @chomik-pawel , If it is still confusing you, follow the Direct Setup. It is now more easy & straight-forward way. [ v1.0.0 update is required] [It is now available on Chrome Web Store] |
Hi, I tried using the Direct Setup, but I am getting the same problem. I am not quite understanding what value should in the "Actual Server Address" field. Do I need my site running on a different server besides VSC Live Server? Here is what I did, exactly: My Live Server Extension Settings are the following: Please let me know what I might be doing wrong, and I am excited about your extension. |
Hi @aalcindo, Live Server will not able to compile your PHP code - That's why php is downloading.... Suppose you don't have Live Server. Now how you can view the PHP code in browser? -> This is the |
I've mentioned here. @aalcindo |
I Eventually got it to work. For anybody who doesn't understand how to do it, I agree the documentation uses vague terms like "Now at the Actual Server add http://localhost/php/ (assuming your actual server is http://localhost/php/)" which doesn't exactly explain HOW to add??? or what does "add" mean when it comes to a server. So this is how I got it to work: Suppose you have a PHP project in your local wamp/xamp and the project is in a folder called "top5" Now you want to make it live reload. Now. inside your project, you should have a .vscode folder and a settings.json file The settings.json file should have this content
You are all set. now if you go to visualstudio code and click the "Go Live" button on the blue bar at the bottom, you should see your browser open http://127.0.0.1:5500 and you will see your project. Reloading after php changes is now working. ** The firewall may ask for permission, so please allow that. Good luck. Thank you for the plugin ritwickdey! |
I am sorry for the documentation. I'v opened a new issue request here #4 |
A draft video tutorial https://www.youtube.com/watch?v=54wcX1G2GH8 |
@ritwickdey Thank you, that should help a lot of people. Awesome functionality! Thanks again! |
Hi, I have a similar but different problem. I create virtual hosts for individual projects (e.g. http://test1.dev, http://test2.dev, etc.), but for some reason the live server always loads the localhost. I assumed that I need to change the proxyUri in settings.json, which I did to "http://test1.dev", but I get the same result (browser loads localhost). What am I doing wrong? |
Turn off proxy setup! Normal start live server form your workspace (lets assume the port is '5500') If the Live Server Web Extension pop-up menu, Stay on http://test1.dev/ ... hit refresh for a single time. From next time, the window will reload automatically. |
Thanks for the quick reply, Ritwick. I forgot one detail! When I turn off the proxy setup and do as you describe, it goes to the right address (to virtual host), but PHP does not compile and I get a directory listing. That's why I originally thought this question belongs in this thread. :) |
Here are my settings in settings.json and in the Chrome extension: "liveServer.settings.donotShowInfoMsg": true, Actual address => http://test1.dev |
Yes!! Start live server.. and say on http://test1.dev (hit refresh for a single time) And made some changes, it will reload the page where http://test1.dev page is opened. |
Stay** |
Does the site already need to be loaded on the browser? The updates seem to work fine that way, but when I launch chrome through the "Go Live" button on the status bar, it still gives me a directory listing even though I have already set the chrome extension to the actual server. If that is true, I guess for updating PHP it is better to set "liveServer.settings.NoBrowser": true, is that correct? |
I think, you're missing my point.. just start live server... & don't browse live server's address. (If it's opening a new tab, just close ta tab) After setting up , live server web extension, open a new tab for http://test1.dev.... (don't browse localhost:5500) |
I think we are saying similar things...unless I am still missing something. So when "Go Live" button on the status bar launches a new browser window, I should just close it since the launched window will not parse PHP code? Isn't that what you mean by "if it opens a new tab, just close the tab?" |
Yes! Close the tab. That server is used to send a feedback to web extension when you made any changes in your workspace. After getting feedback, web extension will refresh tha page accordingly... --- this is the working principal 😄 |
Sounds good. Thanks. |
Is this working on your machine? |
Yes, it works as long as the live server is started and I physically type in the virtual host domain "test1.dev" into the browser window. I guess I was confused because I thought the browser window that opens after clicking the "Go Live" button would parse the PHP code. What I will do from now on is when the window opens to "http://127.0.0.1:5500," I will just type in the domain "test1.dev" and load the page again. |
Yes! I understand! I don't know how I can make clear others about this. If you like to contribute a tutorial or great documentation or update the extension code you're always welcome #4 . Anyway, thanks for the feedback! Please leave a review if you like the small extension https://chrome.google.com/webstore/detail/live-server-web-extension/fiegdmejfepffgpnejdinekhfieaogmj/reviews |
I just left you a review! I can't think of a clear way to explain it, either, but thanks for helping me get it set up. :) Great work on the extension by the way! :) |
Hi @ritwickdey is there any way to get this working for |
Hi guys so... I fixed the problem partly... it's no longer asking me to download a file (.php) but it doesn't auto refresh either... what do I do? --copied the settings in settings.json |
actually I forgot to add extension... :/ This is AWESOME man! may you live long and prosper! |
still not working 👎 with extension or without extension, for the php i am using brackets for long time lol, gg, this is the bug coming from Apache i think that is the reason it's not working i don't know what is doing vscode thay have to fix this bug to debug, compile and code in every platform, any extension is not useful BTW code is not running so what is use of extension. for php |
Hi all |
Me again, i found the solution finally. You must add :
to your settings.json then all works fine ;) |
please check this video tutorial. thanks |
This is the best asnwer! Thanks! |
The Basic setup work form me. I am using VS code, Live reload Extension (for browser and for vscode) and xampp server for php execution. Thanks for all your efforts! |
I'm a new to this live server thing but for .html it worked perfectly fine! But now when I want to use it for .php it want's me to download it instead of executing it. How can I fix it? I'm using Firefox and my settings.json is:
`{
"liveServer.settings.useWebExt": true,
}`
The text was updated successfully, but these errors were encountered: