Ubuntu18.04和16.04上安装PHP(7.3,7.2和7.0)

2019-03-2923:07:04服务器及运维Comments2,273 views字数 3202阅读模式

PHP 7.3是PHP最新的稳定版本,如果你想安装特定版本的PHP,那么本文将对你有所帮助。本篇文章就将给大家介绍如何使用PPA在Ubuntu 18.04、上安装PHP 7.3、、和PHP 。(PPA全称Personal Package Archives即个人软件包文档)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Ubuntu18.04和16.04上安装PHP(7.3,7.2和7.0)
(查看原文请点击本文末尾左下角:阅读原文)

你可以在系统上安装多个PHP版本,并在它们之间切换PHP版本。此外,还可以配置Apache VirtualHosts来使用不同的PHP版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

在Ubuntu上安装PHP 7.3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

使用以下命令集在Ubuntu系统中启用PPA for PHP 7.3并安装它。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install python-software-properties文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo add-apt-repository ppa:ondrej/php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get update文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install -y php7.3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

现在使用以下命令检查系统上已安装的php版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ php -v文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

PHP 7.3.0-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Dec  6 2018 20:24:55) ( NTS )文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Copyright (c) 1997-2018 The PHP Group文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

    with Zend OPcache v7.3.0-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

在Ubuntu上安装PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

PHP 稳定版已经发布。使用以下命令集在Ubuntu系统中启用PPA for PHP 并安装它。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install python-software-properties文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo add-apt-repository ppa:ondrej/php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get update文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install -y php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

现在使用以下命令检查系统上已安装的php版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ php -v文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

PHP .10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Copyright (c) 1997-2018 The PHP Group文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

    with Zend OPcache v.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

在Ubuntu上安装PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

使用以下命令集在Ubuntu系统中为PHP 7添加PPA,并安装PHP 版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install python-software-properties文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo add-apt-repository ppa:ondrej/php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get update文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install -y php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

现在使用以下命令检查系统上已安装的php版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ php -v文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

PHP .24-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:23:58) ( NTS )文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Copyright (c) 1997-2018 The PHP Group文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

    with Zend OPcache v.24-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

在Ubuntu上安装PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

同样使用以下命令集在Ubuntu系统中为PHP 7添加PPA,并安装PHP 版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install python-software-properties文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo add-apt-repository ppa:ondrej/php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get update文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install -y php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

现在使用以下命令检查系统上已安装的php版本。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ php -v文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

PHP .32-4+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov  4 2018 05:11:17) ( NTS )文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Copyright (c) 1997-2017 The PHP Group文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

    with Zend OPcache v.32-4+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

安装PHP 7模块文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

你还可能需要根据你的应用程序需求安装模块。使用以下命令在包存储库中搜索可用的PHP 7模块。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-cache search php7*文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-all-dev - package depending on all supported PHP development packages文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php - server-side, HTML-embedded scripting language (metapackage)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-cgi - server-side, HTML-embedded scripting language (CGI binary)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-cli - command-line interpreter for the PHP scripting language文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-common - documentation, examples and common module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-curl - CURL module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-dev - Files for module development文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-gd - GD module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-gmp - GMP module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

...文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

...文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

...文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-xmlrpc - XMLRPC-EPI module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-zip - Zip module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-opcache - Zend OpCache module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php - server-side, HTML-embedded scripting language (metapackage)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-xsl - XSL module for PHP (dummy)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

...文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

...文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-bcmath - Bcmath module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-bz2 - bzip2 module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-cgi - server-side, HTML-embedded scripting language (CGI binary)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-cli - command-line interpreter for the PHP scripting language文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-common - documentation, examples and common module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-curl - CURL module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

php-dba - DBA module for PHP文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

你可以按照下面的命令在系统上安装所需的PHP模块。通过指定带有包名的版本,确保安装正确的PHP版本的包。在不定义包版本的情况下,它将安装最新的包。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

$ sudo apt-get install php-mysql php-curl php-json php-cgi php-xsl文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html

文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10669.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/yunwei/10669.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定