306-Ubuntu18.04安装PHP(7.0|7.1|7.2)

参考转载:https://www.jianshu.com/p/1505f30290a5

1. Install PHP 7.2 on Ubuntu

PHP 7.2 stable version has been released. Use the following set of commands to enable PPA for PHP 7.2 in your Ubuntu system and install it. You can use this version for production use also.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2

Now use the following command to check installed php version on your system.

$ php -v
PHP 7.2.4-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr  5 2018 08:53:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.4-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

2. Install PHP 7.1 on Ubuntu

Use the following set of commands to add PPA for PHP 7 in your Ubuntu system and install PHP 7.1 version.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1

Now use the following command to check installed php version on your system.

$ php -v
PHP 7.1.16-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr  5 2018 08:47:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.16-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

3. Install PHP 7.0 on Ubuntu

Use the following set of commands to add PPA for PHP 7 in your Ubuntu system and install PHP 7.0 version.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.0

Now use the following command to check installed php version on your system.

$ php -v
PHP 7.0.29-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr  5 2018 08:34:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.29-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

4. Install PHP 7 Modules

You may also need to install modules based on your application requirements. Use the following command to search available PHP 7 modules in the package repository.

sudo apt-cache search php7*



作者:霄峰
链接:https://www.jianshu.com/p/1505f30290a5
來源:简书

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值