1

I am developing a PHP SilverStripe CMS project. In my project, I am using SoapClient to consume Soap API. But when I initialize SoapClient class I got this error.

Class 'SoapClient' not found

I found out that I need to enable SoapClient for docker. Soap is installed/ enabled as in the screenshot below.

enter image description here

According to the accepted answer here I need to enable Soap Client and Soap Server as well. Fatal error: Class 'SoapClient' not found. How can I do that? I am using docker-compose.yml. So whenever I run php command I just run like this, docker-compose exec php-fpm composer install.

Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372

1 Answers1

0

If you are using for example docker php-fpm; You can build from that and add the build to your docker-compose.yaml.

The Dockerfile should look something like this:

FROM (NAMEOFIMAGE)
RUN rm /etc/apt/preferences.d/no-debian-php && apt-get update && apt-get install -y libxml2-dev php-soap && docker-php-ext-install soap

Alternatively, you can add the base image as a service and do the operations on the second line manually inside the container:

docker exec -it container_identifier bash

rm /etc/apt/preferences.d/no-debian-php && apt-get update && apt-get install -y libxml2-dev php-soap && docker-php-ext-install soap

then restart docker-compose.

Hope this helps somebody.