PHP Page is Attempting to Download Instead of Display Content

2.2k Views Asked by At

Problem: I'm creating a website right now, it's my first time dealing with PHP after learning the basics. My index.php file, when viewed on my localhost, is attempting to download the file and bring up the file explorer prompt. Does this on both Chrome and Edge.

Troubleshooting:

  1. I removed the file association.
  2. Tried on Edge browser.
  3. Looked online for answers. All other YouTube videos & forums I found including StackOverflow had previous questions about this but the answers were either outdated by like 10+ years or just didn't for me.

What do I do? Any help is appreciated, and reminder I'm new to PHP so please no super veteran-sized solutions, thanks.

Edit 01: I was told to share my URL so here it is:http://127.0.0.1:5500/index.php

Edit 02 (Solution): I didn't realize that the Live Server plugin for VSC was only for static HTML pages and not PHP pages. WebPajooh helped me with setup how to achieve a similar result using XAMPP.

1

There are 1 best solutions below

8
MuhammadMP On

It was better to share your URL. I guess you are trying to access the PHP files by entering the file path, not the URL.

https://localhost/some_directory/some_file.php

If you are doing this, not entering the file path directly, check your web server configurations.