Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PHP soap extension on Alpine 3.6

I'm having issues trying to install and enable the PHP soap extension. I'm running the base image php:7.2-fpm-alpine3.6 inside a Docker container that has instructions like below in the Dockerfile. It's unclear to me how extensions are installed on Alpine. It seems to use docker-php-ext-install from what I can infer.

Dockerfile (I adopted this from somewhere):

RUN apk --no-cache add \
        freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev \
        wget \
        git \
        nginx \
        ca-certificates \
        supervisor \
        bash \
        nano \
    && docker-php-ext-install \
        mysqli \
        pdo_mysql \
        opcache \
        ...

So, I tried

docker-php-ext-install soap

which told me configure: error: xml2-config not found. Please check your libxml2 installation. I tried a bunch of stuff, but

apk add --no-cache libxml2-dev

seemed to do something. I followed this again with docker-php-ext-install soap, which outputted

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la       modules/* libs/*

At this point, I did not run make test, as it's unclear where I'm suppose to go find this Makefile. I searched under /usr/local/lib/php/extensions/no-debug-non-zts-20170718/, and soap.so was already there. Furthermore, my commands already enabled it for PHP-FPM. php -i showed /usr/local/etc/php/conf.d/docker-php-ext-soap.ini,.

I'm not entirely sure what I did. Is this (docker-php-ext-install) how you install extensions on this OS?

like image 423
musicliftsme Avatar asked Jan 03 '23 20:01

musicliftsme


1 Answers

The PHP SOAP extension requires the PHP XML extension, as documented here: http://php.net/manual/en/soap.requirements.php

I expect you need to install that first.

Presumably docker-php-ext-install xml.

You shouldn't need to compile the XML library yourself as it will be part of the extension.

like image 133
jjok Avatar answered Jan 05 '23 09:01

jjok