0

I'm trying to install the yaml extension on Ubuntu.

I have PHP 7.1 on my server.

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?

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?

phpguru
  • 2,351
  • 2
  • 23
  • 33
  • Does this answer your question? [How do I change the default PHP base-version on shell?](https://stackoverflow.com/questions/56198160/how-do-i-change-the-default-php-base-version-on-shell) – Paulo Boaventura Nov 15 '20 at 23:51

1 Answers1

1

Have you tried

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