简体   繁体   English

如何在Ubuntu 16.04上安装PHP 7.1 Yaml扩展而不是7.2

[英]How to install PHP 7.1 yaml extension and not 7.2 on Ubuntu 16.04

I'm trying to install the yaml extension on Ubuntu. 我正在尝试在Ubuntu上安装yaml扩展。

I have PHP 7.1 on my server. 我的服务器上安装了PHP 7.1。

ubuntu@www1:~$ php -v
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar  6 2018 11:27:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.15-1+ubuntu14.04.1+deb.sury.org+2, Copyright 
    (c) 1999-2018, by Zend Technologies

I was following another SO post that said to run 我正在关注另一个据说可以运行的帖子

sudo apt install libyaml-dev php-dev php-pear

When I do that, the installer says, in part: 当我这样做时,安装程​​序会部分说明:

The following extra packages will be installed:
  dh-php php7.2-cli php7.2-common php7.2-dev php7.2-json php7.2-opcache
  php7.2-readline pkg-php-tools xml2
Suggested packages:
  dh-make
The following NEW packages will be installed:
  dh-php php-dev php7.2-cli php7.2-common php7.2-dev php7.2-json
  php7.2-opcache php7.2-readline pkg-php-tools xml2
0 upgraded, 10 newly installed, 0 to remove and 85 not upgraded.
Need to get 3,073 kB of archives.
After this operation, 18.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

So, why would the installer install PHP 7.2 extensions on a PHP 7.1 server? 那么,为什么安装程序会在PHP 7.1服务器上安装PHP 7.2扩展?

I aborted the install and came here to ask: 我中止了安装,来到这里问:

How do I force my server to stay at PHP 7.1 and install the yaml extension? 如何强制服务器保持PHP 7.1并安装yaml扩展?

你有没有尝试过

sudo apt-get install -y php7.1-yaml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM