Why are the PHP files downloaded instead of processed by Nginx?

Solution 1:

Note to add:

I went through the same deal, but after applying the fix, the ol' ctrl+shift+r wasn't good enough to refresh the browser's cache that the page was a download --

After erasing the cache more thoroughly, it worked as expected.

Solution 2:

I was able to get this issue fixed, but the problem I had seems to have been related to the fact that I still had Apache setup on the server, and some part of Apache was conflicting with Nginx's ability to server php pages, even though Apache was not running.

If you run into the same issue try to remove Apache, PHP and all related modules, and re-install just what you need.


Solution 3:

is this file contains anything ?

(include mime.types;)

because if not so all of your files getting the mime/type of a download file

(default_type application/octet-stream;)

so this is your problem because php is not on the list

solution : add this row to that file and restart ngnix

text/php                             php php5;

Tags:

Nginx

Php

Php Fpm