Repository navigation
Errors messages on Bookworm based image #1425
Copy link
Copy link
Closed
Description
Hi, since 8.2-apache use Bookworm I have errors messages for some built PHP extensions when the entrypoint is executed :
msehr | PHP Warning: PHP Startup: Unable to load dynamic library 'gnupg' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/gnupg (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/gnupg: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/gnupg.so (libgpgme.so.11: cannot open shared object file: No such file or directory)) in Unknown on line 0
msehr | PHP Warning: PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so (libc-client.so.2007e: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imap.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
msehr | PHP Warning: PHP Startup: Unable to load dynamic library 'yaml' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/yaml (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/yaml: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/yaml.so (libyaml-0.so.2: cannot open shared object file: No such file or directory)) in Unknown on line 0
msehr | PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so (libzip.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
The Dockerfile :
# https://hub.docker.com/_/php
FROM php:8.2-apache
ENV PHPSTAGE production
ARG DEBIAN_FRONTEND=noninteractive
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
ghostscript \
git \
imagemagick \
mariadb-client \
pdftk-java \
; \
rm -rf /var/lib/apt/lists/*
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get -y update;\
apt-get install -y --no-install-recommends \
libc-client-dev \
libcurl4-openssl-dev \
libgpgme11-dev \
libkrb5-dev \
libmagickwand-dev \
libonig-dev \
libyaml-dev \
libzip-dev \
&& \
pecl install gnupg && \
pecl install imagick && \
pecl install yaml && \
docker-php-ext-enable gnupg imagick yaml; \
PHP_OPENSSL=yes docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
docker-php-ext-install \
bcmath \
curl \
dom \
gd \
imap \
intl \
mbstring \
pdo_mysql \
soap \
xml \
zip && \
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
rm -r /tmp/pear; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
a2enmod rewrite headers ssl; \
rm -rf /usr/src/*; \
mv "$PHP_INI_DIR/php.ini-$PHPSTAGE" "$PHP_INI_DIR/php.ini" && \
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' "$PHP_INI_DIR/php.ini" && \
sed -i 's/post_max_size = 8M/post_max_size = 20M/' "$PHP_INI_DIR/php.ini" && \
sed -i 's/;max_input_vars = 1000/max_input_vars = 20000/' "$PHP_INI_DIR/php.ini"
COPY --from=composer:2.5 /usr/bin/composer /usr/local/bin/composer
COPY config/vhost-docker /etc/apache2/sites-available/000-default.conf
ENV VRELEASE master
RUN curl -fsSL -o /tmp/msehr.tar.gz https://github.com/MedShake/MedShakeEHR-base/archive/"$VRELEASE".tar.gz && \
mkdir /usr/src/medshakeehr && \
tar -xf /tmp/msehr.tar.gz -C /usr/src/medshakeehr --strip-components=1 && \
rm /tmp/msehr.tar.gz
COPY config/MEDSHAKEEHRPATH-docker /usr/src/medshakeehr/public_html/MEDSHAKEEHRPATH
VOLUME /var/www/html/
COPY msehr.entrypoint /usr/local/bin/
ENTRYPOINT ["msehr.entrypoint"]
CMD ["apache2-foreground"]
The entrypoint :
#!/bin/bash
set -e
if [ ! -e /var/www/html/public_html/index.php ]; then
echo "Copie de MedShakeEHR ..."
cp -pr /usr/src/medshakeehr/* /var/www/html/
cd /var/www/html && \
composer install -n --no-plugins --no-scripts --no-cache --no-ansi --no-progress --no-dev -o && \
cd public_html && \
composer install -n --no-plugins --no-scripts --no-cache --no-ansi --no-progress --no-dev -o
fi
if [ ! -e /var/www/html/config/config.yml ]; then
echo "Configuration absente, création ..."
generate_random_string() {
openssl rand -base64 12
}
set_default_value() {
if [ -z "$1" ]; then
echo "$2"
else
echo "$1"
fi
}
FINGERPRINT=$(set_default_value "$FINGERPRINT" "$(generate_random_string)")
SQLVARPSWD=$(set_default_value "$SQLVARPSWD" "$(generate_random_string)")
PROTO=$(set_default_value "$PROTO" "https")
PORT=$(set_default_value "$PORT" "")
COOKIED=$(set_default_value "$COOKIED" "31104000")
echo "
sqlRootId: ""
sqlRootPwd: ""
sqlNotCreatDb: true
protocol: $PROTO://
host: $VIRTUAL_HOST
port: $PORT
urlHostSuffixe: ""
webDirectory: /var/www/html/public_html/
stockageLocation: /var/www/html/stockage/
backupLocation: /var/www/html/backups/
workingDirectory: /var/www/html/public_html/workingDirectory/
cookieDomain: $VIRTUAL_HOST
cookieDuration: $COOKIED
fingerprint: $FINGERPRINT
sqlServeur: db
sqlBase: $MYSQL_DATABASE
sqlUser: $MYSQL_USER
sqlPass: $MYSQL_PASSWORD
sqlVarPassword: $SQLVARPSWD
templatesFolder: /var/www/html/templates/
twigEnvironnementCache: false
twigEnvironnementAutoescape: false
twigDebug: false
configForm: ""
" > /var/www/html/config/config.yml
fi
uid="$(id -u)"
if [ "$uid" = 0 ]; then
chown -R www-data:www-data /var/www/html/*
fi
exec "$@"
The errors messages are fixed when I use 8.2-apache-bullseye tag. Do you think the Path has changed on Bookworm ? I miss another thing ?
Thanks for your reply
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
yosifkit commentedon Jul 24, 2023
Yeah, paths did change. Bookworm moved to UsrMerge by default. This means
/libis a symlink to/usr/lib, so somelddreturned paths need to be adjusted so that Debian can figure out which package it belongs to (since the package will report/usr/lib...now). The fix is in #1416 (and also nodejs/docker-node#1927) and is backwards compatible with Bullseye:ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ | sort -u \ | xargs -r dpkg-query -S \ | cut -d: -f1 \ | sort -u \ | xargs -rt apt-mark manual; \marsante commentedon Jul 24, 2023
Thank you so much for your response. I hadn't seen the pull request. I will watch the evolution of the Dockerfile next time.
yosifkit commentedon Jul 24, 2023
No worries, glad it was an easy fix.