Installing apache 2.4 and php 5.5 on ubuntu 12.04

Refresh

December 2018

Views

43.8k time

14

I'm trying to set a test enviroment with apache 2.4 and php 5.5 on a vm with ubuntu 12.04, fist thing is to add the repositories

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

Then installing apache 2.4

apt-get install apache2-mpm-worker

checking apache version:

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

Installing 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

Checking php version

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

So everyting seems ok the thing is I need mod_fastcgi but can't be installed:

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.

So if mod_fastcgi can't be enabled how can I run php files with php-fpm ? Is there something I'm missing ?

2 answers

10

Вы можете установить FastCGI моды и apache2 отсюда, проверить , что он работает на моем конце. https://launchpad.net/~ondrej/+archive/apache2?field.series_filter=precise

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

потому что вы сделали что-то тупое (как я, например, с попыткой установить php5 поверх php2.3 предоставленного UBUNTU изображения я работаю), вы можете выполнить следующие команды:

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