Php: SoapClient is enabled, but Class SOAPClient does not exist

Created on 15 Jan 2019  路  2Comments  路  Source: docker-library/php

I need PHPSoap in my Docker project and wanted to activate it now. The module is loading, phpinfo also shows it to me. But when I call var_dump(class_exists("SOAPClient")) I get a false. I tried all attempts from thread https://github.com/docker-library/php/issues/315 , but nothing worked.
Some people say you have to install php-soap, which I can't do because php-soap has no installation candidate, others say it's not necessary.

Any ideas?

PHPInfo:

Soap Client enabled
Soap Server enabled
Directive   Local Value Master Value
soap.wsdl_cache 1   1
soap.wsdl_cache_dir /tmp    /tmp
soap.wsdl_cache_enabled 1   1
soap.wsdl_cache_limit   5   5
soap.wsdl_cache_ttl 86400   86400

My Dockerfile:
```FROM php:7.1-apache

ENV ACCEPT_EULA=Y
ENV APACHE_DOCUMENT_ROOT /app
RUN a2enmod rewrite

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/
.conf

RUN mkdir /usr/share/man/man1

COPY config/php.ini /usr/local/etc/php/

ARG MSSQL_DRIVER_VER=5.2.0

Install the PHP Driver for SQL Server & jre for swagger-codegen

RUN apt-get update -yqq \
&& apt-get install -y apt-transport-https gnupg graphviz libzip-dev libxml2-dev \
&& curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl -s https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update -yqq \
&& ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales default-jre \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen

Install via Pecl(PHP) package management

RUN pecl install -f pdo_sqlsrv-${MSSQL_DRIVER_VER} sqlsrv-${MSSQL_DRIVER_VER} xdebug zip \
&& docker-php-ext-install soap \
&& docker-php-ext-enable pdo_sqlsrv sqlsrv xdebug zip

Set xdebug

ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
COPY config/xdebug.ini /tmp/xdebug.ini
RUN cat /tmp/xdebug.ini >> $XDEBUGINI_PATH

vhost

COPY config/vhost.conf /etc/apache2/sites-enabled/vhost.conf
```

question

Most helpful comment

Thanks, it was a Layer 8 Error. I've copied var_dump(class_exists("SOAPClient")) from the interwebs and the quotation marks were the wrong ones.

All 2 comments

As noted in https://github.com/docker-library/php/issues/315#issuecomment-264645332 and https://github.com/docker-library/php/issues/75#issuecomment-131795436, soap requires libxml2-dev, I see you have installed that so the issue I would imagine is with some other environmental effect of yours

$ docker build -t php:test - << EOF
> FROM php
> 
> RUN apt-get update && apt-get install -y libxml2-dev --no-install-recommends
> 
> RUN docker-php-ext-install soap
> EOF
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM php
 ---> 1c2ea94dffeb
Step 2/3 : RUN apt-get update && apt-get install -y libxml2-dev --no-install-recommends
 ---> Using cache
 ---> a3fa85056dd7
Step 3/3 : RUN docker-php-ext-install soap
 ---> Using cache
 ---> db01d8e5fc1c
Successfully built db01d8e5fc1c
Successfully tagged php:test
$ docker run -it --rm php:test php -a
Interactive shell

php > var_dump(class_exists("SOAPClient")) ;
bool(true)

Thanks, it was a Layer 8 Error. I've copied var_dump(class_exists("SOAPClient")) from the interwebs and the quotation marks were the wrong ones.

Was this page helpful?
0 / 5 - 0 ratings