php 如何在apache中启用php7模块?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35988990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:39:21  来源:igfitidea点击:

How to enable php7 module in apache?

phpapacheubuntu

提问by YanDatsiuk

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

当我尝试运行时a2enmod php7.0- 我收到消息“正在考虑 php7.0 的 php5 冲突”。

After restarting apache - apache can't start.

重新启动 apache 后 - apache 无法启动。

How to solve this?

如何解决这个问题?

Maybe some already enabled modules links to php5?

也许一些已经启用的模块链接到 php5?

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

参数:Ubuntu Wily、Apache 2.4.18、PHP 7.0.4(仅适用于 cli)

回答by hjpotter92

First, disable the php5module:

首先,禁用php5模块:

a2dismod php5

then, enable the php7module:

然后,启用php7模块:

a2enmod php7.0

Next, reload/restart the Apache service:

接下来,重新加载/重启 Apache 服务:

service apache2 restart


Update 2018-09-04

更新 2018-09-04

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

WRT的评论,你需要指定精确的安装PHP-7.x的版本。

回答by Adrien Horgnies

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

我在以下线程上找到了解决方案: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

我的情况不仅是 php 不起作用,而且 phpmyadmin 我也是这样一步一步地做的

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

然后到:

gksu gedit /etc/apache2/apache2.conf

在最后一行我添加 Include /etc/phpmyadmin/apache.conf

解决所有问题

马切伊

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

如果它解决了您的问题,请在原始帖子中对该解决方案进行投票。

回答by vladkras

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

对于寻找相同问题解决方案的 Windows 用户。我刚补

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

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

在我的 /conf/extra/httpв-xampp.conf