question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PHP downloading instead of executing

See original GitHub issue

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,

"liveServer.settings.proxy": {
    "enable": true,
    "baseUri": "/src",
    "proxyUri": "http://127.0.0.1:80"
},

"liveServer.settings.CustomBrowser": "firefox",

}`

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:36 (15 by maintainers)

github_iconTop GitHub Comments

11reactions
CristianEnachecommented, Oct 31, 2017

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” You normally access it at this address: http://127.0.0.1/top5/

Now you want to make it live reload. Assuming you have installed the liveserver extension in visualstudio code and the browser extension in your browser, you should activate the browser extension and DO NOT CHECK “I don’t want proxy setup” because we actually want proxy setup for live reload of php projects. Just enable it by clicking the live reload button on the extension.

Now. inside your project, you should have a .vscode folder and a settings.json file

The settings.json file should have this content

{
    "liveServer.settings.useWebExt": true,
    "liveServer.settings.proxy": {
        "enable": true,
        "baseUri": "/",
        "proxyUri": "http://127.0.0.1/top5/"
    },
}

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! A video tutorial would help a lot of people.

3reactions
ritwickdeycommented, Jan 28, 2018

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, Actual address => http://test1.dev LiveServer Address => http://localhost:5500

Stay on http://test1.dev/ … hit refresh for a single time. From next time, the window will reload automatically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache is downloading php files instead of displaying them
If you are prompted to download a .php file instead of executing it, then here is the perfect solution: I assume that you...
Read more >
PHP files are downloaded instead of executed, how do I solve ...
PHP files are downloaded instead of executed, how do I solve it? · Log into your cPanel account · Click on the File...
Read more >
PHP files downloading instead of executing. - InMotion Hosting
Instead of PHP files executing, they are downloading. I've uploaded a test index. php file for testing purposes.
Read more >
PHP files downloading instead of executing - DigitalOcean
Hello, I installed NGINX as a reverse proxy for my Apache and when I'm trying to access the web, It starts downloading the...
Read more >
How to fix the problem of PHP files downloading ... - Quora
Go to options—-then to proxy/socks. · Ensure its on manual proxy/socks configuration. · Click get from IE at the top · Click a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found