【问题标题】:Installing apache 2.4 and php 5.5 on ubuntu 12.04在 ubuntu 12.04 上安装 apache 2.4 和 php 5.5
【发布时间】:2014-02-18 20:43:02
【问题描述】:

我正在尝试在具有 ubuntu 12.04 的 vm 上使用 apache 2.4 和 php 5.5 设置测试环境,第一件事是添加存储库

apt-add-repository ppa:ptn107/apache
apt-add-repository ppa:ondrej/php5

然后安装 apache 2.4

apt-get install apache2-mpm-worker

检查 apache 版本:

# apache2 -v
Server version: Apache/2.4.6 (Ubuntu)
Server built:   Sep 23 2013 07:23:34

安装 PHP 5.5

apt-get install php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-cli php5-fpm php-pear php5-dev php5-imap php5-mcrypt

检查php版本

php -v
PHP 5.5.8-3+sury.org~precise+1 (cli) (built: Jan 24 2014 10:15:11) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
     with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

所以一切看起来都不错,只是我需要 mod_fastcgi 但无法安装:

apt-get install libapache2-mod-fastcgi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-fastcgi : Depends: apache2.2-common (>= 2.2.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如果 mod_fastcgi 无法启用,我该如何使用 php-fpm 运行 php 文件?有什么我想念的吗?

【问题讨论】:

  • 扩展一点,最后我没有用mod_fastcgi,而是用ProxyPassMatch

标签: php package ubuntu-12.04 apt-get apache2.4


【解决方案1】:

你可以从这里安装 fastcgi mod 和 apache2,验证它在我这边工作。 https://launchpad.net/~ondrej/+archive/apache2?field.series_filter=precise

【讨论】:

  • 是的,使用 ppa:ondrej/apache2 而不是 ppa:ptn107/apache 有效。我现在可以看到这是多么明显。谢谢。
【解决方案2】:

除了上面的 suci 和 wedev 的回答,如果你看到类似这样的错误:

dpkg: error processing /var/cache/apt/archives/apache2-   bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb (--unpack):
trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.10

因为你做了一些愚蠢的事情(例如,我试图在我正在使用的 ubuntu 映像提供的 php2.3 之上安装 php5),你可以运行以下命令:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/apache2-bin_2.4.16-3+deb.sury.org~precise+1_amd64.deb
sudo dpkg -i --force-overwrite /var/cache/apt/archives/apache2-data_2.4.16-3+deb.sury.org~precise+1_all.deb
sudo dpkg -i --force-overwrite /var/cache/apt/archives/apache2_2.4.16-3+deb.sury.org~precise+1_amd64.deb

如此处所述:https://askubuntu.com/questions/666720/ubuntu-apt-get-upgrade-error-on-ubuntu-12-04 by user3703155

我相信它会指示包管理器消除有关 apache2 安装的任何损坏的依赖项。

后续运行

apt-get install -f 

紧随其后

apt-get dist-upgrade

然后一切都很开心。

php -version
PHP 5.5.30-1+deb.sury.org~precise+1 (cli) (built: Oct  4 2015 16:14:34) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with XCache Optimizer v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo

【讨论】:

    猜你喜欢
    • 2014-06-22
    • 2015-09-24
    • 2016-03-11
    • 1970-01-01
    • 2019-06-19
    • 2013-03-31
    • 1970-01-01
    • 2014-08-12
    • 2012-12-10
    相关资源
    最近更新 更多