install php 7 to run beside php 5 on ubuntu with nginx

迅800發表於2017-07-19

How to install php 7 to run beside php 5 on ubuntu with nginx


PHP 7.0 on Ubuntu 14 or 16

1.Enter the following commands in the order shown:

sudo apt-get -y update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get -y update
sudo apt-get install -y php7.0 php7.0-dev libapache2-mod-php7.0 php7.0 php7.0-common php7.0-fpm php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv

2.Enter the following command to verify PHP 7 installed properly:

php -v

PHP 7.0.8-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
  with Zend OPcache v7.0.8-2+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies

PHP 5.6 on Ubuntu 14

To install PHP 5.6 or to upgrade from PHP 5.5 on Ubuntu 14:
1.Enter the following commands in the order shown:

apt-get -y update
add-apt-repository ppa:ondrej/php
apt-get -y update
apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip

2.Enter the following command to verify PHP 5.6 installed properly:

php -v

PHP 5.6.22-4+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

PHP 5.5 on Ubuntu 14

To install PHP 5.5 on Ubuntu 14:
1.Enter the following commands in the order shown:

apt-get -y update
apt-get -y install php5 php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl

2.Verify the PHP version by entering php -v. Messages similar to the following should display:

PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep  4 2014 06:56:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

參考:
http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html

相關文章