Browser downloading PHP files instead of executing them. Webmin + NGinx
The Problem
I attempted to upgrade from PHP 7.0 to 7.2 today and it resulted in websites on the server downloading through the browser instead of executing like normal.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php7.0 php7.0-common
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring
My Question
Can anyone provide me some examples of how to debug this? And any additional insight as to what may be going on?
My Theory
Technically I don't know what caused this, but my experience tells me it's one line, in one file, coming from NGinx that needs edited.
What I've Tried
I found this issue to be commonly reported here on SO. But the solutions have lacked critical information such as the file path, or the file paths they reference don't exist on my system, or the proposed solution doesn't resolve the issue.
Many articles mentioned configurations for PHP FPM and / or FastCGI. But I'm unable to identify how to confirm whether or not these are installed / running and what a proper configuration looks like for a standard web server.
What Helped
I did update my /etc/nginx/nginx.conf file from default_type application/octet-stream; to default_type text/html; and this has stopped the downloading of files but results in a blank page. Including my phpinfo.php
My Environment
- AWS EC2 Small
- Ubuntu 18.04
- NGinx 1.10.3
- Webmin
- Virtualmin
php nginx php-7.2 webmin virtualmin
|
show 4 more comments
The Problem
I attempted to upgrade from PHP 7.0 to 7.2 today and it resulted in websites on the server downloading through the browser instead of executing like normal.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php7.0 php7.0-common
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring
My Question
Can anyone provide me some examples of how to debug this? And any additional insight as to what may be going on?
My Theory
Technically I don't know what caused this, but my experience tells me it's one line, in one file, coming from NGinx that needs edited.
What I've Tried
I found this issue to be commonly reported here on SO. But the solutions have lacked critical information such as the file path, or the file paths they reference don't exist on my system, or the proposed solution doesn't resolve the issue.
Many articles mentioned configurations for PHP FPM and / or FastCGI. But I'm unable to identify how to confirm whether or not these are installed / running and what a proper configuration looks like for a standard web server.
What Helped
I did update my /etc/nginx/nginx.conf file from default_type application/octet-stream; to default_type text/html; and this has stopped the downloading of files but results in a blank page. Including my phpinfo.php
My Environment
- AWS EC2 Small
- Ubuntu 18.04
- NGinx 1.10.3
- Webmin
- Virtualmin
php nginx php-7.2 webmin virtualmin
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
1
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56
|
show 4 more comments
The Problem
I attempted to upgrade from PHP 7.0 to 7.2 today and it resulted in websites on the server downloading through the browser instead of executing like normal.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php7.0 php7.0-common
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring
My Question
Can anyone provide me some examples of how to debug this? And any additional insight as to what may be going on?
My Theory
Technically I don't know what caused this, but my experience tells me it's one line, in one file, coming from NGinx that needs edited.
What I've Tried
I found this issue to be commonly reported here on SO. But the solutions have lacked critical information such as the file path, or the file paths they reference don't exist on my system, or the proposed solution doesn't resolve the issue.
Many articles mentioned configurations for PHP FPM and / or FastCGI. But I'm unable to identify how to confirm whether or not these are installed / running and what a proper configuration looks like for a standard web server.
What Helped
I did update my /etc/nginx/nginx.conf file from default_type application/octet-stream; to default_type text/html; and this has stopped the downloading of files but results in a blank page. Including my phpinfo.php
My Environment
- AWS EC2 Small
- Ubuntu 18.04
- NGinx 1.10.3
- Webmin
- Virtualmin
php nginx php-7.2 webmin virtualmin
The Problem
I attempted to upgrade from PHP 7.0 to 7.2 today and it resulted in websites on the server downloading through the browser instead of executing like normal.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php7.0 php7.0-common
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring
My Question
Can anyone provide me some examples of how to debug this? And any additional insight as to what may be going on?
My Theory
Technically I don't know what caused this, but my experience tells me it's one line, in one file, coming from NGinx that needs edited.
What I've Tried
I found this issue to be commonly reported here on SO. But the solutions have lacked critical information such as the file path, or the file paths they reference don't exist on my system, or the proposed solution doesn't resolve the issue.
Many articles mentioned configurations for PHP FPM and / or FastCGI. But I'm unable to identify how to confirm whether or not these are installed / running and what a proper configuration looks like for a standard web server.
What Helped
I did update my /etc/nginx/nginx.conf file from default_type application/octet-stream; to default_type text/html; and this has stopped the downloading of files but results in a blank page. Including my phpinfo.php
My Environment
- AWS EC2 Small
- Ubuntu 18.04
- NGinx 1.10.3
- Webmin
- Virtualmin
php nginx php-7.2 webmin virtualmin
php nginx php-7.2 webmin virtualmin
edited Nov 20 '18 at 0:21
Spencer Hill
asked Nov 20 '18 at 0:13
Spencer HillSpencer Hill
340421
340421
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
1
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56
|
show 4 more comments
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
1
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
1
1
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56
|
show 4 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384442%2fbrowser-downloading-php-files-instead-of-executing-them-webmin-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384442%2fbrowser-downloading-php-files-instead-of-executing-them-webmin-nginx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I got the same problem a few times in an apache envirement. I don't know alot about nginx thought but check the vhost file and also your htaccess. Most of the time thats where the problem is.
– Patrick Simard
Nov 20 '18 at 0:23
Thanks but only Apache uses .htaccess and I'm running NGinx which uses a global and site specific nginx.conf file.
– Spencer Hill
Nov 20 '18 at 0:25
Could you elaborate on what you mean by checking my vhosts file?
– Spencer Hill
Nov 20 '18 at 0:25
try this: stackoverflow.com/questions/25591040/…
– Patrick Simard
Nov 20 '18 at 0:27
1
Sorry bro. Try posting your question at serverfault.com instead. stackoverflow is more suited for programing questions then server problems.
– Patrick Simard
Nov 20 '18 at 0:56