Website downloading php file






















I know that there are 1. So I figured that I would add the solution to my problem here. If I commented these two lines out in my. I have no idea what they do or how they got there, - but it is in every one of my.

I have VirtualMin installed on an Ubuntu I upgraded to PHP version 7. I got the error that his post talks about: For every site on my VPS, it simply downloaded the index. I had a similar problem to the OP when upgrading php5 from an older version, to 5. I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server.

So I maintain a perfect local mirror of the actual site. After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine.

PHP was not parsed. The phpinfo command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code. This worked. I got this kind of problem. This is how I solve it. Different type of PHP versions installed to my computer. Then I remove some PHP packages from my previous list, using apt-get purge. For people who have found this post from Google almost 6 years in the future and beyond!

Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module. Running PHP scripts in user directories is disabled by default.

You must comment or delete the tag block at the bottom that reads. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

Learn more. Apache is downloading php files instead of displaying them Ask Question. Asked 8 years, 3 months ago. Active 1 year ago. Viewed k times. OS and server information: CentOS 6. Thank you. EDIT: I have these lines in the php. Anthony Gainor. Anthony Gainor Anthony Gainor 1, 2 2 gold badges 9 9 silver badges 9 9 bronze badges. Well, how did you install it? Which SAPI? Your php module is not running. I edited the questions.

The modules do exits and they are being loaded apparently — Anthony Gainor. Did you restart apache after installation? Show 6 more comments. Active Oldest Votes. Mihkel Mihkel 6 6 silver badges 2 2 bronze badges. Could you add some info where to put these lines?

For people looking for where to put these lines. In my case , on Apache This works, adding d part to x-http-php like on your post works! I've configured php from source — Liso. Add a comment. So here is another possible cause: If you have something like AddHandler x-mapp-php6. I had the some problem but found the culprit. If anyone else has the same issue, look for. I had an. It was forcing a version of PHP that was not installed on my local machine.

Thus the virtual host wasn't executing the PHP file properly. This is almost certainly the problem if some sites work and others don't. Show 1 more comment. After struggling a lot I finally solved the problem. But If you are still getting the error : Config file php5.

Ravi Shankar Ravi Shankar 1 1 silver badge 5 5 bronze badges. Note that this only works under Linux and specifically Debian Linux.

Please take a look at your addtype directives. Clearing your browser cache is always a good idea. AddHandler php5-script. DirectoryIndex index. Sam Azer Sam Azer 3 3 bronze badges. The problem here is that PHP is not being run correctly somehow, or the wrong headers are being sent Note the last AddType directive which is commented out in the above example, causes a.

Is it possible that your Apache configuration is pretty-printing. You can begin installation of modules like, sudo apt-get install libapache2-mod-php7.

Noushad Noushad 4, 3 3 gold badges 22 22 silver badges 27 27 bronze badges. Thanks to all!!! Ladislao Garcia Ladislao Garcia 62 2 2 bronze badges. Take care of browser cache too. My system : Ubuntu Do NOT set it to On as it prevents. What's in your PHP file? Also, do you have PHP configured to work with the server? Does the downloaded file contain the original PHP source?

If so, it's not executing. Stephen I may see what they say as well. Joe I does contain the original PHP source yes. Show 1 more comment. Active Oldest Votes. You might have only have the cli version of PHP installed currently try sudo apt-get install php5 and restart apache sudo apache2ctl restart.

You can also check the PHP module is loaded into apache by doing sudo apache2ctl -M Which if the module is loaded then it should show something like Loaded Modules Syntax OK. Improve this answer.

Mark Davidson Mark Davidson 4 4 silver badges 11 11 bronze badges. Add a comment. Thanks a lot. It would look something like this: Use for PHP 5. Do NOT set it to On as it prevents. I did what it says and restarted apache and the problem had gone.

Adrian Heine 4 4 silver badges 22 22 bronze badges. Burak Yildiz Burak Yildiz 21 2 2 bronze badges. After chmoding it it worked. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer? Featured on Meta.



0コメント

  • 1000 / 1000