在 ubuntu 16.04 上安装 php7.4 - Dockerfile
install php7.4 on ubuntu 16.04 - Dockerfile
我正在尝试使用以下命令安装 php7.4 和相关包
FROM ubuntu:16.04
RUN apt update \
&& apt install -y software-properties-common\
&& add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& apt-get install -y php7.4
我收到以下消息
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.4
E: Couldn't find any package by glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'
使用
搜索
apt-cache search php7
我看到只有7.0相关的包可用
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
我很困惑为什么我没有得到更新的版本,因为 7.3、7、4 和 8 应该是今天唯一可用的版本。我怎样才能得到 php7.4 个包裹?
在 Ubuntu 20.04
上安装 PHP 7.4
注意:Ubuntu 20.04 在其上游存储库中附带 PHP 7.4。只需使用 apt 包管理器安装它和扩展即可。
sudo apt update
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
确认PHP版本:
$ php --version
PHP 7.4.3 (cli) (built: Mar 26 2020 20:24:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
在 Ubuntu 18.04/16.04
上安装 PHP 7.4
第 1 步:添加 PHP PPA 存储库
我们将添加 ppa:ondrej/php PPA 存储库,其中包含 PHP.
的最新构建包
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
步骤 2:在 Ubuntu 18.04/19.04/16.04 上安装 PHP 7.4
使用以下命令在 Ubuntu 18.04/19.04/16.04 上安装 PHP 7.4:
sudo apt -y install php7.4
检查安装的版本:
$ php -v
PHP 7.4.0beta4 (cli) (built: Aug 28 2019 11:41:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v7.4.0beta4, Copyright (c), by Zend Technologies
使用下一个命令安装额外的包:
sudo apt-get install php7.4-xxx
示例:
sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip,common}
PHP Apache相关的配置存放在/etc/php/7.4/apache2/php.ini
希望我的经验对大家有帮助
TL;DR: 自从 Ubuntu 16.04 达到“标准支持结束”后,它的软件包已从 PPA 中删除。
您可能想阅读此内容:https://github.com/oerdnj/deb.sury.org/issues/1567
In April 2021, Ubuntu 16.04 Xenial will reach End of Standard Support and will be available only as a paid option through Ubuntu Extended Security Maintenance.
What does it mean for DEB.SURY.ORG PPAs?
The packages for Ubuntu 16.04 will be deleted shortly after the EoL/EoSS is announced, usually at the same time as the next PHP release is published because it's not possible to build the packages any more.
The packages for Ubuntu 16.04 will be available via PHP LTS by Freexian paid program. This is cheaper option than previously announced Private dedicated repositories.
我正在尝试使用以下命令安装 php7.4 和相关包
FROM ubuntu:16.04
RUN apt update \
&& apt install -y software-properties-common\
&& add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& apt-get install -y php7.4
我收到以下消息
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.4
E: Couldn't find any package by glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'
使用
搜索apt-cache search php7
我看到只有7.0相关的包可用
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
我很困惑为什么我没有得到更新的版本,因为 7.3、7、4 和 8 应该是今天唯一可用的版本。我怎样才能得到 php7.4 个包裹?
在 Ubuntu 20.04
上安装 PHP 7.4注意:Ubuntu 20.04 在其上游存储库中附带 PHP 7.4。只需使用 apt 包管理器安装它和扩展即可。
sudo apt update
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
确认PHP版本:
$ php --version
PHP 7.4.3 (cli) (built: Mar 26 2020 20:24:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
在 Ubuntu 18.04/16.04
上安装 PHP 7.4第 1 步:添加 PHP PPA 存储库 我们将添加 ppa:ondrej/php PPA 存储库,其中包含 PHP.
的最新构建包sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
步骤 2:在 Ubuntu 18.04/19.04/16.04 上安装 PHP 7.4 使用以下命令在 Ubuntu 18.04/19.04/16.04 上安装 PHP 7.4:
sudo apt -y install php7.4
检查安装的版本:
$ php -v
PHP 7.4.0beta4 (cli) (built: Aug 28 2019 11:41:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v7.4.0beta4, Copyright (c), by Zend Technologies
使用下一个命令安装额外的包:
sudo apt-get install php7.4-xxx
示例:
sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip,common}
PHP Apache相关的配置存放在/etc/php/7.4/apache2/php.ini
希望我的经验对大家有帮助
TL;DR: 自从 Ubuntu 16.04 达到“标准支持结束”后,它的软件包已从 PPA 中删除。
您可能想阅读此内容:https://github.com/oerdnj/deb.sury.org/issues/1567
In April 2021, Ubuntu 16.04 Xenial will reach End of Standard Support and will be available only as a paid option through Ubuntu Extended Security Maintenance.
What does it mean for DEB.SURY.ORG PPAs?
The packages for Ubuntu 16.04 will be deleted shortly after the EoL/EoSS is announced, usually at the same time as the next PHP release is published because it's not possible to build the packages any more.
The packages for Ubuntu 16.04 will be available via PHP LTS by Freexian paid program. This is cheaper option than previously announced Private dedicated repositories.