Why does apache download my index.php file






















Are you sure you want to replace the current answer with this one? Hollie's Hub for Good Supporting each other to make an impact. Write for DigitalOcean You get paid, we donate to tech non-profits. I have completely same files as in this tutorial. Only domain changed. I need help with this. These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can type! Hi there ondrejnovy ,. Does this also happen if you try to access the Apache service directly on port ? For example if you create an info.

Also, do you have a. I got it to work with the line: sudo apt-get install libapache2-mod-php7. Improve this answer.

Alastair Mason Alastair Mason 2 2 silver badges 3 3 bronze badges. Thanks for naming this library. I knew I had to install a library to fix this but did not know the name. The libapache2-mod-php7. Not until You should use libapache2-mod-php5 instead. Sometimes even worse things can happen I just forgot to install php. Tebe Tebe 3 3 silver badges 11 11 bronze badges. I hardly think this can be called a real answer, but I guess it sorta is. When you have a reasonable number of machines and it's reasonably late in the evening, this is definitely a valid answer.

A valid answer indeed. I had a problem juggling php5, php5-cli, php5-fpm, and php-whatnot. Apache was just missing the right package. Community Bot 1.

You need to configure apache so that it will start the php interpreter when a. This needs to be done in httpd. Why is Apache downloading PHP files instead of displaying them? After updating PHP to 7. Why is my PHP script not showing up? Now apache is showing the source code, but not all of it just part.

I added. When you're configuring apache then try to view the page from another browser - I've had days when chrome stubbornly caches the result and it keeps downloading the source code while in another browser it's just fine. I came across this issue today and none of the solutions described worked for me. So here is another possible cause:. In my case the server did not know the x-mapp-php6 type, since that.

Just removing the AddHandler line from the. If you are prompted to download a. Turns out files shouldn't be stored in mods-enabled , but should rather be stored in mods-available.

A symlink should then be created in mods-enabled pointing to the file stored in mods-available. Regarding the suggestion above that you should tell the browser that you are outputting a PHP script: It seemed like an unusual idea to me. I googled it and found that there is quite a bit of discussion about it on the web. If Your. This might be happening due to the missing modules required for your php.

Assuming you have php7 installed, search available php7 modules using. Above command will list all available PHP7 modules for installation. You can begin installation of modules like,.

I have the same problem. Apache doesn't load php files from a certain website, just downloaded it. I read this post and the answers and I have seen I've got this line into the last place of the.

After updating PHP to 7. I previously has a similar issue, after upgrading from 5. I spent two days tracking this and found out that I was putting my PHP scripts in the wrong directory. I just started PHP work, so I don't know if my solution relates to the version change you went through. I had this problem. It turned out that I had both nginx and apache installed and automatically starting on boot.

The problem was that nginx was binding to the http port first which prevented apache from starting. It's also possible that you have nginx running but your php is set up to run with apache. To verify, run service nginx status and service apache2 status to see which is running. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start and your server will now serve php files as expected.

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.



0コメント

  • 1000 / 1000