codecasts / php-alpine

PHP APK Repository for Alpine Linux
https://github.com/codecasts/php-alpine
483 stars 58 forks source link

Unable to initialize modules on simple build #95

Closed brogier closed 4 years ago

brogier commented 4 years ago

Hi all,

I'm experiencing some strange behaviour when trying out this repository. When I run this basic Dockerfile.

FROM alpine:3.10

ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub

RUN apk --update add ca-certificates
RUN echo "https://dl.bintray.com/php-alpine/v3.10/php-7.4" >> /etc/apk/repositories

RUN apk --no-cache --update add \
    curl \
    php-cli \
    php-opcache \
    php-ctype \
    php-fpm \
    php-bcmath

php -v PHP Warning: Failed loading Zend extension 'opcache' (tried: /usr/lib/php7/modules/opcache (Error loading shared library /usr/lib/php7/modules/opcache: No such file or directory), /usr/lib/php7/modules/opcache.so (Error relocating /usr/lib/php7/modules/opcache.so: zend_hash_set_bucket_key: symbol not found)) in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library 'bcmath' (tried: /usr/lib/php7/modules/bcmath (Error loading shared library /usr/lib/php7/modules/bcmath: No such file or directory), /usr/lib/php7/modules/bcmath.so (Error relocating /usr/lib/php7/modules/bcmath.so: php_error_docref: symbol not found)) in Unknown on line 0

PHP Warning: PHP Startup: ctype: Unable to initialize module Module compiled with module API=20190902 PHP compiled with module API=20180731 These options need to match in Unknown on line 0 PHP 7.3.14 (cli) (built: Jan 27 2020 21:55:23) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.14, Copyright (c) 1998-2018 Zend Technologies

Am I missing something?

php --ini Configuration File (php.ini) Path: /etc/php7 Loaded Configuration File: /etc/php7/php.ini Scan for additional .ini files in: /etc/php7/conf.d Additional .ini files parsed: /etc/php7/conf.d/00_bcmath.ini, /etc/php7/conf.d/00_ctype.ini, /etc/php7/conf.d/00_opcache.ini

cat /etc/php7/conf.d/00_opcache.ini zend_extension=opcache

/usr/lib/php7/modules/opcache.so exists so everything seems fine.

Hope anyone can help me out!

Kind regards,

Rogier

brogier commented 4 years ago

Found out that php-cli is not supported. How can I use php -v on my build for composer etc?

brogier commented 4 years ago

For anyone reading... use php7 -v

Man I feel like a dumb f... trying for a whole day xD

f3l1x commented 4 years ago

@rogierverbrugge Take a look at full example. :-)

https://github.com/dockette/ci/blob/master/php/php74/Dockerfile https://github.com/dockette/ci/tree/master/php