Prompt asking to download/save the actual .php file

Problem:

I have created my .php script. Now when I press the "send" button in my html form, I get a promt asking me if i'd like to download/save the actual .php file.

Solution:

This is a symptom that the web server is not able to process the PHP script. Possible reasons:

  • The web server cannot process PHP script.
  • The file extension for the PHP script is not the same as the allowed by the web server
  • The webhosting provider is limiting the directories where PHP scripts can be executed, so you must move the script to that directory.
  • Corrupted PHP script, which is sending incorrect data to the browser.


The easiest way to determine if the web hosting service supports PHP is to create a simple PHP file and execute it from the web browser:

<?
echo "This is a test";
?>

copy those 3 lines in a text file and upload it to your web server.

Execute it from the web browser.

If:

  • Don't get "This is a test" in the browser
  • See all PHP code in the browser
  • You're asked to download a file


Then PHP is not executing in your web server. Ask your web hosting provider for support.