I've installed both Apache2 and PHP7.0 on my Ubuntu 14.04 and on running localhost I get a Apache welcome page but placing a info.php file inside /var/www/html/ doesn't give me any specific page but instead gives me raw php code.
I'm new to this and I've searched alot but couldn't find any suitable resource as all of them use php5 instead of php 7.
They talk about editing configuration files but I don't understand which files they are really talking about.
Plus there is no mention as to why are such changes made to the files.
I would be very helpful if someone could please help me out with instructions on the same along with explanations.
Thank you.
P.S. I have two php in my /etc/ folder, php5 and php7.0. Which one should I use? And should I purge the other one?

  • What does "installed both Apache2 and PHP7.0" mean? How did you installed it? – oerdnj Jul 11 '16 at 14:17
  • @oerdnj I'd installed both of them apt-get but removed it afterwards only to manually install them from source, but now I cannot link them together. – Shivam Aggarwal Jul 11 '16 at 15:23
  • I would recommend using a clean system if you don't exactly know what you did in the past. – oerdnj Jul 11 '16 at 15:24
  • I'd removed all pre-existing files and did a fresh install, but couldn't make out how to link them together. – Shivam Aggarwal Jul 11 '16 at 15:26
  • Then you need to describe the exact commands you have used to compile and install apache2 and PHP – oerdnj Jul 11 '16 at 15:30

I used this link to reinstall php on ubuntu and all the required php modules.


But to help you, try these -

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
service apache2 reload

Last one is just to restart apache server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.