Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable php7 module in apache?

Tags:

php

apache

ubuntu

When I try to run a2enmod php7.0 - I got message "Considering conflict php5 for php7.0".

After restarting apache - apache can't start.

How to solve this?

Maybe some already enabled modules links to php5?

Params: Ubuntu Wily, Apache 2.4.18, PHP 7.0.4 (works only cli)

like image 990
YanDatsiuk Avatar asked Mar 14 '16 13:03

YanDatsiuk


3 Answers

First, disable the php5 module:

a2dismod php5

then, enable the php7 module:

a2enmod php7.0

Next, reload/restart the Apache service:

service apache2 restart

Update 2018-09-04

wrt the comment, you need to specify exact installed php-7.x version.

like image 86
hjpotter92 Avatar answered Nov 03 '22 10:11

hjpotter92


I found the solution on the following thread : https://askubuntu.com/questions/760907/upgrade-to-16-04-php7-not-working-in-browser

Im my case not only the php wasn't working but phpmyadmin aswell i did step by step like that

sudo apt install php libapache2-mod-php
sudo apt install php7.0-mbstring
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
service apache2 restart

And then to:

gksu gedit /etc/apache2/apache2.conf

In the last line I do add Include /etc/phpmyadmin/apache.conf

That make a deal with all problems

Maciej

If it solves your problem, up vote this solution in the original post.

like image 32
Adrien Horgnies Avatar answered Nov 03 '22 09:11

Adrien Horgnies


For Windows users looking for solution of same problem. I just repleced

LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"

in my /conf/extra/httpв-xampp.conf

like image 1
vladkras Avatar answered Nov 03 '22 08:11

vladkras