PHP 7.3是PHP的最新版本,如果你想裝指定版本的PHP,這篇文章對(duì)你有很大的幫助。本文將幫助你在Ubuntu 18.04,16.04上通過(guò)PPA的方式安裝PHP 7.3 7.2和7.0。
安裝PHP 7.3
通過(guò)下列命令安裝PHP 7.3
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.3
安裝完成后,使用如下命令檢查PHP的版本
$ php -v
PHP 7.3.3-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:31:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.3-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
安裝PHP 7.2
通過(guò)下列命令安裝PHP 7.2
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.2
安裝完成后,使用如下命令檢查PHP的版本
$ php -v
PHP 7.2.16-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:23:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.16-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
安裝PHP 7.1
通過(guò)下列命令安裝PHP 7.1
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.1
安裝完成后,使用如下命令檢查PHP的版本
$ php -v
PHP 7.1.27-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:02:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.27-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
安裝PHP 7.0
通過(guò)下列命令安裝PHP 7.0
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php7.0
安裝完成后,使用如下命令檢查PHP的版本
$ php -v
PHP 7.0.33-5+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 8 2019 09:49:15) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-5+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
安裝PHP 7模塊
使用如下命令安裝PHP 7模塊
$ sudo apt-cache search php7*
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
...
...
...
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
php7.1-zip - Zip module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-xsl - XSL module for PHP (dummy)
...
...
php7.2-bcmath - Bcmath module for PHP
php7.2-bz2 - bzip2 module for PHP
php7.2-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli - command-line interpreter for the PHP scripting language
php7.2-common - documentation, examples and common module for PHP
php7.2-curl - CURL module for PHP
php7.2-dba - DBA module for PHP
用如下命令,按需安裝PHP擴(kuò)展模塊,安裝之前,確保安裝正確的PHP版本。
$ sudo apt-get install php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php7.2-xsl
安裝完成后,現(xiàn)在就可以開(kāi)始php開(kāi)發(fā)了。
總結(jié)
以上所述是小編給大家介紹的在Ubuntu 18.04上安裝PHP 7.3 7.2和7.0的方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!
您可能感興趣的文章:- PHP遠(yuǎn)程連接oracle數(shù)據(jù)庫(kù)操作實(shí)現(xiàn)方法圖文詳解
- ThinkPHP5.0框架使用build 自動(dòng)生成模塊操作示例
- PHP生成隨機(jī)碼的思路與方法實(shí)例探索
- PHP實(shí)現(xiàn)網(wǎng)站應(yīng)用微信登錄功能詳解
- PHP之認(rèn)識(shí)(二)關(guān)于Traits的用法詳解
- ThinkPHP框架下微信支付功能總結(jié)踩坑筆記
- 微信公眾平臺(tái)開(kāi)發(fā)教程④ ThinkPHP框架下微信支付功能圖文詳解
- 微信公眾平臺(tái)開(kāi)發(fā)教程③ PHP實(shí)現(xiàn)微信公眾號(hào)支付功能圖文詳解
- ThinkPHP框架實(shí)現(xiàn)的微信支付接口開(kāi)發(fā)完整示例
- PHP中str_split()函數(shù)的用法講解