3

I am having problems installing yaml support on my php docker configuraiton. Here is my dockerbuild file:

FROM php:7.2.2-apache
RUN docker-php-ext-install mysqli
# Install YAML extension
RUN  pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini && docker-php-ext-enable yaml

But I am getting error:

configure: error: Please install libyaml

I googled, but haven`t found working solution yet. Any ideas how should I do it?

Note:

RUN apt-get install libyaml

Havent worked, got message E: Unable to locate package libyaml

And also this command havent worked:

yum install libyaml-devel

error: yum install libyaml-devel

Markus Berg
  • 331
  • 2
  • 11

2 Answers2

6

First you need to run the update and then install the required package that is libyaml-dev.

FROM php:7.2.2-apache
RUN docker-php-ext-install mysqli
# Install YAML extension
RUN apt-get update -y
RUN apt-get install libyaml-dev -y
RUN  pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini && docker-php-ext-enable yaml

How do I install the yaml package for Python?

Adiii
  • 54,482
  • 7
  • 145
  • 148
0

I found also different way, maybe for someone easier because adding php extension is really simple. https://github.com/mlocati/docker-php-extension-installer

And here is my final Dockerfile

   FROM php:7.2.2-apache
    ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
    RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
        install-php-extensions mysqli yaml
Markus Berg
  • 331
  • 2
  • 11