ritwickdey / live-server-web-extension

It makes your existing server live. This is a browser extension that helps you to live reload feature for dynamic content (PHP, Node.js, ASP.NET -- Whatever, it doesn't matter)
https://chrome.google.com/webstore/detail/live-server-web-extension/fiegdmejfepffgpnejdinekhfieaogmj/
MIT License
800 stars 330 forks source link

php Code is being Downloaded instead of Executing #59

Open harshvardhan-web opened 3 years ago

harshvardhan-web commented 3 years ago

I created a form using php. The home page i.e. index.html has an anchor tag which links to a php file (form.php). Whenever the anchor tag text is clicked the github pages downloads the php file instead of loading it. It worked fine as long as i was doing it on localhost but now when i created a new live server in sql it doesn't seem to work. I have checked for any connection issues to live server and there were none. Any help will be appreciated. Thanks

jslalriya commented 3 years ago

Well, first your question is not clear. You said, 'when I created a new live server in SQL it doesn't seem to work', so, which live server you created and how? I don't get it.

Anyway, remember one thing, whenever a browser starts downloading a PHP file instead of loading it, that means, your PHP server is not working. Before loading / testing PHP file, make sure you start PHP server.

harshvardhan-web commented 3 years ago

When I was running my files on local host using xampp the form seemed to work just fine....but when i created a new online database on my sql website with free access it didn't seem to work on github pages......after updating connection.php file with new host name database name password, it seemd to work fine when i ran it again on locahost to check if connection was successful....but when i tried to do the same on github pages the index.html gets loaded...then when i click on anchor tag to take me to the form.php page it downloads the file instead of executing it.

what do you mean by start php server? while testing i tried it on localhost and it worked just fine then when i closed xampp and hosted the form through github pages it didn't work

mricim commented 3 years ago

When I was running my files on local host using xampp the form seemed to work just fine....but when i created a new online database on my sql website with free access it didn't seem to work on github pages......after updating connection.php file with new host name database name password, it seemd to work fine when i ran it again on locahost to check if connection was successful....but when i tried to do the same on github pages the index.html gets loaded...then when i click on anchor tag to take me to the form.php page it downloads the file instead of executing it.

what do you mean by start php server? while testing i tried it on localhost and it worked just fine then when i closed xampp and hosted the form through github pages it didn't work

I think @harshvardhan-web wants to expose his PHP web in GitHub Pages and I have bad news for you: As @jslalriya said "GitHub Pages" does not support PHP. You can see it in this link to the Community GitHub. This is the reason why the PHP sheets are downloaded and not displayed. "GitHub Pages" can only display static code, like HTML, JS, CSS, etc. You can read more at GitHub Docs

Aayushman1 commented 1 year ago

Thanks for the answer, I had the same issues with Github Pages. Where should I upload my page when I want to run PHP-Script on my web page?

00Danish00 commented 1 year ago

im facing same issue bro now i have t represent my project on localhost only

mdnurulmomen commented 3 months ago

Even though its already been late, But it may help someone in future.

Try using different browser or chrome incognito mode for opening php files. If still its not working, there might be permission issues.