Ubuntu 14.04上安装php7.0并配置apache2

sudo a2dismod php5
sudo add-apt-repository ppa:ondrej/apache2
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
# 看情况选择
#sudo apt-get install php7.0-cli php7.0-common  php7.0-curl php7.0-gd php7.0-mysql php7.0-curl php7.0-xml php7.0-memcache php7.0-memcached php7.0-intl php7.0-mongo php7.0-mongodb php7.0-mbstring
sudo apt-get install libapache2-mod-php7.0
sudo a2enmod php7.0
sudo service apache2 restart

Note: If your system’s locale is set to anything other than UTF-8, adding the PPA may fail due to a bug handling characters in the author’s name. As a workaround, you can install language-pack-en-base to make sure that locales are generated, and override system-wide locale settings while adding the PPA:

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

如果遇到Apache环境变量问题,可以执行

source /etc/apache2/envvars

PPA for Apache 2.x
How To Upgrade to PHP 7 on Ubuntu 14.04
The main PPA for PHP (5.6, 7.0, 7.1) with many PECL extensions

你可能感兴趣的:(Ubuntu 14.04上安装php7.0并配置apache2)