thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
768 stars 137 forks source link

Extra extentions loading not working for BitBucket pipeline #377

Closed sdespont closed 3 months ago

sdespont commented 6 months ago

I am trying to enable some extra extensions in BitBucket pipeline. But the extensions are not enabled even with the entry point script execution (https://github.com/thecodingmachine/docker-images-php/issues/89). Could you help me figure it out ?

image:
  name: thecodingmachine/php:8.1-v4-fpm
  environment:
    PHP_EXTENSION_GD: 1
    PHP_EXTENSION_TIDY: 1
    PHP_EXTENSION_BCMATH: 1
    PHP_EXTENSION_IMAP: 1
    PHP_EXTENSION_INTL: 1

pipelines:
  default:
    - step:
        name: PHPCS and PHPStan
        size: 1x
        script:
          - /usr/local/bin/docker-entrypoint.sh echo "entrypoint executed"

Also tried with

image:
  name: thecodingmachine/php:8.1-v4-fpm
  environment:
    PHP_EXTENSIONS=gd tidy bcmath imap intl

php -m output :

[PHP Modules]
apcu
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
igbinary
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
mistraloz commented 6 months ago

Hello. I can not test with bitbucket but with cli, it's work : docker run --rm -it -e"PHP_EXTENSIONS=gd tidy bcmath imap intl" thecodingmachine/php:8.1-v4-fpm php -m | grep bcmath

To force regeration of configuration (manually), you can run :

/usr/bin/real_php /usr/local/bin/generate_conf.php | sudo tee "/etc/php/${PHP_VERSION}/mods-available/generated_conf.ini" > /dev/null
PHP_VERSION="${PHP_VERSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | sudo bash

If the bug it's not fix with that, please execute the manual commands (without > /dev/null `) and give me the result of std/err output + content of /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini

PS: for pipeline, it's not fpm that you may need but cli variant (but both should work).

uuf6429 commented 5 months ago

I had a similar problem. In the bitbucket log, this line came up:

Invalid environment variable value found for PHP_EXTENSION_FFI. Value: "%!s(int=1)". Valid values are "0", "1", "yes", "no", "true", "false", "on", "off".

Previously my docker-compose file looked like so (as yaml hashes):

    environment:
      PHP_EXTENSION_FFI: true

These also failed:

      PHP_EXTENSION_FFI: 1
      PHP_EXTENSION_FFI: "true"

In the end I went for - PHP_EXTENSIONS=ffi (as a yaml string list) and that worked. No idea where the problem started.

@sdespont note that your second try is wrong:

Also tried with

image:
  name: thecodingmachine/php:8.1-v4-fpm
  environment:
    PHP_EXTENSIONS=gd tidy bcmath imap intl

You need to prefix lines with a dash to have a yaml string list:

image:
  name: thecodingmachine/php:8.1-v4-fpm
  environment:
    - PHP_EXTENSIONS=gd tidy bcmath imap intl
stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please update it if any action still required.

stale[bot] commented 3 months ago

This issue has been automatically closed because it has not had recent activity. Please, reopen if you need.