Caddy Docker does not have PHP XML extension?!

Hey guys,

I’ve been debugging a problem that has plagued me since last month. Basically, I fail to connect to my WordPress blog via the mobile apps. After further testing, it seemed that my xmlrpc.php file was not getting parsed correctly.

When I tested the file, I got a -32700 error, not well formed parse error. When I enabled WordPress Debug Logs and ran the tests again, this is what I got:

[19-Dec-2016 16:24:44 UTC] PHP Notice:  PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension. in /srv/wordpress/wp-includes/IXR/class-IXR-message.php on line 48
[19-Dec-2016 16:24:48 UTC] PHP Notice:  PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension. in /srv/wordpress/wp-includes/IXR/class-IXR-message.php on line 48

The rest of the site runs fine, so I just have to figure out how to run “PHP’s XML extension” or whatever thing like that. How do I do this? Is there a plugin I need to install? But I have a docker image, how can I install plugins?


Which Caddy docker are you running, out of curiosity? Strictly speaking, your issue is with that container’s maintainer. Your options are:

  1. Convince the maintainer to include and enable the PHP XML extension
  2. Manually install/enable php-xml each time you update your container
  3. Roll your own Caddy+PHP container
  4. Refactor your setup to use separate Caddy and PHP containers

My advice is to take option 4. You can use a Caddy container sans PHP and a dedicated off-the-shelf PHP container such as Bitnami’s PHP-FPM Docker. I do this myself so that I can “swap” my PHP version for individual sites by rewriting the fastcgi directive to point it to the container with the correct PHP version.

1 Like

Hi Whitestrake. Sorry for the late reply but I’ve been tinkering with other projects and didn’t have a chance to get on the forum.

I’m using Abiosoft’s docker image. After running docker exec -it Caddy sh and then running php -m, I found that SimpleXML and XMLWriter extensions were already installed. I don’t think I saw the xml extension.

I tried to set up Bitnami’s PHP-FPM docker but failed because that spat out a meaningless error message. Don’t know what it was because I didn’t have time to check, just removed the container. Any other options left for me? And really, why doesn’t Abiosoft’s docker have the XML extension?

Hi Eric,

You can find the Dockerfile that Abiosoft uses for his PHP+Caddy container here. You’ll note he’s added a number of extensions but seems to have missed php5-xml.

Looking at the Alpine packages repository, I can see php5-xml exists for the version of Alpine that Abiosoft builds from.

You can build from Abiosoft’s container and simply add the required extension, which would solve your issue quite handily:

FROM abiosoft/caddy:php
RUN apk add --no-cache php5-xml

Further implementation details depend on your Docker orchestration method.

I note that php5-xml is quite small, perhaps it would not be difficult to have a pull request approved to add that extension to Abiosoft’s image.

Great, thanks! I’ll check if I can get a pull request going.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.