Wordpress: Php-soap extension

Created on 14 Nov 2015  路  7Comments  路  Source: docker-library/wordpress

I can't get the php-extension php-soap to load correctly.

Dockerfile:

FROM php:5.6-apache
RUN a2enmod rewrite

# install the PHP extensions we need
RUN apt-get update && apt-get install -y \
            libpng12-dev \
            libjpeg-dev \
            php-pear \
            php-http-request \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
    && docker-php-ext-install gd
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install php-soap

...

Output:

Step 5 : RUN docker-php-ext-install php-soap
 ---> Running in 1a433edf267f
error: /usr/src/php/ext/php-soap does not exist

usage: /usr/local/bin/docker-php-ext-install ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt mssql mysql mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets spl standard sybase_ct sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip
Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install php-soap' returned a non-zero code: 1

Most helpful comment

That's one way to do it, however every time you recreate the WordPress container, you will need to redo these steps.

The method I used was adding the php extensions in the Dockerfile built from the docker-compose.yml file. The Dockerfile looks like:

FROM php:5.6-apache

RUN a2enmod rewrite expires

# install the PHP extensions we need
RUN apt-get update && apt-get install -y \
        libpng12-dev \
        libjpeg-dev \
        libxml2-dev \
        libmcrypt-dev \
        libmhash2 \
        libc6 \
        php5-mcrypt \
        php-pear \
        php-http-request \
        zlib1g \
        bzip2 \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
    && docker-php-ext-install gd mysqli opcache mcrypt soap

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=60'; \
        echo 'opcache.fast_shutdown=1'; \
        echo 'opcache.enable_cli=1'; \
    } > /usr/local/etc/php/conf.d/opcache-recommended.ini

VOLUME /var/www/html

ENV WORDPRESS_VERSION 4.5.1
ENV WORDPRESS_SHA1 9bf09e0ca8f656b650b3056339e2d3eb28c6355e

# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
    && echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
    && tar -xzf wordpress.tar.gz -C /usr/src/ \
    && rm wordpress.tar.gz \
    && chown -R www-data:www-data /usr/src/wordpress

COPY docker-entrypoint.sh /entrypoint.sh

# make entrypoint executable
RUN chmod +x /entrypoint.sh

# grr, ENTRYPOINT resets CMD now
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

All 7 comments

I believe this should work:

RUN docker-php-ext-install soap
 configure: error: xml2-config not found. Please check your libxml2 installation.
 Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install soap' returned a non-zero code: 1

Resolved the issue. I needed to also install libxml12-dev and add RUN chmod +x /entrypoint.sh to the Dockerfile.

Could you please describe how did you made this? Thank you!

I've solved it myself. So here are the steps I made to get the soap extension to work:

  • get shell access to the wordpress container then
/bin/bash
apt-get update
apt-get install libxml2-dev
apt-get install php-soap
cd /usr/src/php/ext/soap
./configure
make
make install
docker-php-ext-enable soap

Exit the container and in the directory where your docker-compose.yml file is type:

docker-compose stop
docker-compose start 

To verify create a php file with phpinfo(), open it and you should see that the soap extension is loaded.

That worked for me and i hope it can be usefull for other...

That's one way to do it, however every time you recreate the WordPress container, you will need to redo these steps.

The method I used was adding the php extensions in the Dockerfile built from the docker-compose.yml file. The Dockerfile looks like:

FROM php:5.6-apache

RUN a2enmod rewrite expires

# install the PHP extensions we need
RUN apt-get update && apt-get install -y \
        libpng12-dev \
        libjpeg-dev \
        libxml2-dev \
        libmcrypt-dev \
        libmhash2 \
        libc6 \
        php5-mcrypt \
        php-pear \
        php-http-request \
        zlib1g \
        bzip2 \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
    && docker-php-ext-install gd mysqli opcache mcrypt soap

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=60'; \
        echo 'opcache.fast_shutdown=1'; \
        echo 'opcache.enable_cli=1'; \
    } > /usr/local/etc/php/conf.d/opcache-recommended.ini

VOLUME /var/www/html

ENV WORDPRESS_VERSION 4.5.1
ENV WORDPRESS_SHA1 9bf09e0ca8f656b650b3056339e2d3eb28c6355e

# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
    && echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
    && tar -xzf wordpress.tar.gz -C /usr/src/ \
    && rm wordpress.tar.gz \
    && chown -R www-data:www-data /usr/src/wordpress

COPY docker-entrypoint.sh /entrypoint.sh

# make entrypoint executable
RUN chmod +x /entrypoint.sh

# grr, ENTRYPOINT resets CMD now
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

I tried many times and this is the way I did finally:

RUN apt-get update && apt-get install -y libxml2-dev
RUN docker-php-ext-install soap
Was this page helpful?
0 / 5 - 0 ratings

Related issues

shankie-codes picture shankie-codes  路  5Comments

Wyvern picture Wyvern  路  5Comments

adriatic picture adriatic  路  5Comments

etc0de picture etc0de  路  4Comments

LabDeve picture LabDeve  路  5Comments