本文介绍了没有mod_php? 14.04/ondrej php5.6 + ondrej apache2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图获得一个运行PHP 5.6的14.04盒,但是在Apache中启用PHP时遇到了问题.具体来说,似乎不再安装了mod_php吗?

Trying to get a 14.04 box running PHP 5.6, but having issues getting PHP enabled in apache. Specifically, it doesn't seem mod_php is being installed anymore?

apt-get update
apt-get install -y python-software-properties
add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:ondrej/apache2
apt-get update
apt-get upgrade -y

apt-get install -y htop apache2 php5.6 php5.6-curl php5.6-mcrypt mongodb-org curl git

a2enmod不列出phpmod_php,并且locate php.ini输出:

a2enmod does not list php or mod_php, and locate php.ini outputs:

/etc/php/5.6/cli/php.ini
/etc/php/5.6/fpm/php.ini
/usr/lib/php/5.6/php.ini-development
/usr/lib/php/5.6/php.ini-production
/usr/lib/php/5.6/php.ini-production.cli

但是,不处理apache服务的index.php中包含<?php phpinfo();的情况.

However including a <?php phpinfo(); in an index.php served by apache is not processed.

帮助表示赞赏!

推荐答案

TLDR

apt-get install libapache2-mod-php5.6

长答案

因此,我找到了解决方案,尽管简单,但是却不像官方的php包那样直观.

Long Answer

So I found the solution, which although simple, is not as intuitive as the official php packages.

在添加了apache2和php PPA并安装了所有软件包之后,还需要手动安装libapache2-mod-php5.6软件包,这将添加php5.6 apache2模块.混乱之处在于,默认的ubuntu php5软件包在安装过程中包括了该软件包,但是ondrej的PPA却没有.

After adding the apache2 and php PPA's, and installing all the packages, one needs to manually install the libapache2-mod-php5.6 package as well, which adds the php5.6 apache2 module. The confusion is that the default ubuntu php5 packages include this package as part of the install, however the ones from ondrej's PPA do not.

万一有人想知道或关心,我能够通过在他的github存储库中搜索已关闭的问题来解决此问题,该问题旨在跟踪其PPA的问题:问题#266 为我提供了线索.

In case anyone wants to know or cares, I was able to solve this by searching through the closed issues on his github repo which is meant to track issues with his PPA's: Issue #266 gave me the clue.

这篇关于没有mod_php? 14.04/ondrej php5.6 + ondrej apache2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 20:58