How to configure Apache 2 to run PHP 7.0

5,569

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

http://tecadmin.net/install-php-7-0-apache-2-4-mysql-5-6-on-ubuntu/

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.

Share:
5,569

Related videos on Youtube

Shivam Aggarwal
Author by

Shivam Aggarwal

Updated on September 18, 2022

Comments

  • Shivam Aggarwal
    Shivam Aggarwal over 1 year

    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?

    • oerdnj
      oerdnj almost 8 years
      What does "installed both Apache2 and PHP7.0" mean? How did you installed it?
    • Shivam Aggarwal
      Shivam Aggarwal almost 8 years
      @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.
    • oerdnj
      oerdnj almost 8 years
      I would recommend using a clean system if you don't exactly know what you did in the past.
    • Shivam Aggarwal
      Shivam Aggarwal almost 8 years
      I'd removed all pre-existing files and did a fresh install, but couldn't make out how to link them together.
    • oerdnj
      oerdnj almost 8 years
      Then you need to describe the exact commands you have used to compile and install apache2 and PHP