2014-01-27 88 views
14

我正在嘗試設置與Apache 2.4和PHP 5.5的測試環境上使用Ubuntu 12.04虛擬機,拳頭就是添加庫在Ubuntu上安裝Apache 2.4和PHP 5.5 12.04

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

然後安裝阿帕奇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 

所以everyting似乎確定的事情是我需要的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文件嗎?有什麼我失蹤?

+0

爲了擴展一點,我沒有在最後使用'mod_fastcgi',而是使用'ProxyPassMatch'。 – poxtron

回答

1

除了蘇吉以上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 

,因爲你做了一件愚蠢的(像我一樣,例如有超過PHP2的頂部安裝PHP5的嘗試。通過我正在使用Ubuntu的圖像),可以運行下面的命令提供3:

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通過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