I am using a php7
in docker container
to run a service based on phpdocx library. It needs tidy
and some other extensions installed and active to work. I have installed php-tidy
however I am getting following warning.
PHP Warning: PHP Startup: Unable to load dynamic library 'tidy' (tried: /usr/lib/php7/modules/tidy (Error loading shared library /usr/lib/php7/modules/tidy: No such file or directory), /usr/lib/php7/modules/tidy.so (Error relocating /usr/lib/php7/modules/tidy.so: _zval_ptr_dtor: symbol not found)) in Unknown on line 0
Dockerfile
FROM php:7.3.2-cli-alpine3.9
USER root
COPY . code
WORKDIR code
RUN apk update && apk add php-tidy && apk add php-zip && apk add php-curl && apk add php-sodium
# RUN sed -i s/;extension=tidy/extension=tidy/ -f /usr/local/etc/php/php.ini-development
# RUN sed -i s/;extension=tidy/extension=tidy/ -f /usr/local/etc/php/php.ini-production
COPY php.ini /usr/local/etc/php/php.ini-development
COPY php.ini /usr/local/etc/php/php.ini-production
COPY php.ini /usr/local/etc/php/php.ini
CMD php -S 0.0.0.0:8080
Output from docker shell
on running phpinfo()
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
# vi /usr/local/etc/php/php.ini
extension=tidy
[Tidy]
; The path to a default tidy configuration file to use when using tidy
; http://php.net/tidy.default-config
;tidy.default_config = /usr/local/lib/php/default.tcfg
; Should tidy clean and repair output automatically?
; WARNING: Do not use this option if you are generating non-html content
; such as dynamic images
; http://php.net/tidy.clean-output
tidy.clean_output = Off
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "/usr/lib/php7/modules/"
; On windows:
;extension_dir = "ext"
#ls /usr/lib/php7/modules/
curl.so sodium.so tidy.so zip.so