Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney:
Building a usable ext-tidy for Alpine-based PHP Docker images
Nov 02, 2018 @ 15:22:29

On his site Matthew Weier O'Phinney has a new post sharing a method he's worked up for creating a Docker image for PHP from an Alpine image that included the "tidy" PHP extension.

I've been working on building PHP Docker images for the purposes of testing, as well as to potentially provide images containing the Swoole extension. [...] This week, I decided to see if I could build Alpine-based images, as they can greatly reduce the final image size. And I ran into a problem.

One of the test-beds I use builds RSS and Atom feeds using zend-feed. When I tried one of these images, I started getting failures. [...] During an initial search, this appeared to be a problem due to libxml2 versions. [...] I realized [after debugging] that the problem was the content — which was being massaged via the tidy extension before being passed to DOMDocument::loadXML(). For some reason, the content generated was not valid XML!

In order to solve this issue (after spending a good deal of time debugging it) he went on a hunt to figure out the previous version. Once he found that it was just a few simple lines in his Dockerfile to include the right version and install it using the apk package manager (example of this is included).

tagged: docker tidy xml issue debugging tutorial

Link: https://mwop.net/blog/2018-11-01-alpine-php-ext-tidy.html


Trending Topics: