Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed PHP extension is not loading in mac M2 chip #924

Closed
theaungmyatmoe opened this issue May 25, 2024 · 8 comments
Closed

Installed PHP extension is not loading in mac M2 chip #924

theaungmyatmoe opened this issue May 25, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@theaungmyatmoe
Copy link

Version of install-php-extensions

v.2.2.14

Error description

When I check the php modules with php -m installed extensions are not even showing.



1dff27fb3a07:/var/www/html$ php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
random
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

1dff27fb3a07:/var/www/html$```

### Docker image

dunglas/frankenphp:lastest-php-8.3-alpine

### Minimal Dockerfile

```Dockerfile
ARG PHP_VERSION=8.3
ARG FRANKENPHP_VERSION=latest
ARG COMPOSER_VERSION=2.7.6

FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine

RUN apk update; \
    apk upgrade; \
    apk add --no-cache  \
    bash \
    curl \
    supervisor \
    nodejs \
    npm  \
    libsodium-dev \
    librdkafka-dev \
    g++ \
    make \
    autoconf \
    && apk del autoconf g++ make  \
    && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* \

RUN install-php-extensions \
        redis \
        rdkafka \
        exif \
        pdo_mysql \
        zip \
        sockets \
        pcntl \
        opcache \
        mongodb \
        gd \
        opcache \
        intl \
        bcmath
@theaungmyatmoe theaungmyatmoe added the bug Something isn't working label May 25, 2024
@mlocati
Copy link
Owner

mlocati commented May 25, 2024

Have you tried to add

RUN php -m

At the end of your dockerfile?

@theaungmyatmoe theaungmyatmoe changed the title Installed PHP extension is not working. Installed PHP extension is not loading. May 25, 2024
@theaungmyatmoe theaungmyatmoe changed the title Installed PHP extension is not loading. Installed PHP extension is not loading in mac M2 chip May 25, 2024
@theaungmyatmoe
Copy link
Author

Yes, I've tried.

➜  breeze git:(main) ✗
docker compose up auth
WARN[0000] /Users/aungmyatmoe/Workspace/breeze/docker-compose.yaml: `version` is obsolete
[+] Building 1.8s (17/26)                                                                                                                                         docker:orbstack
 => [auth internal] load build definition from Dockerfile                                                                                                                    0.0s
 => => transferring dockerfile: 2.40kB                                                                                                                                       0.0s
 => WARN: Empty continuation line found in: RUN apk update;     apk upgrade;     apk add --no-cache      bash     curl     supervisor     nodejs     npm      libsodium-dev  0.0s
 => [auth internal] load metadata for breezemm.com/bun:latest                                                                                                                0.0s
 => [auth internal] load metadata for docker.io/dunglas/frankenphp:latest-php8.3-alpine                                                                                      1.4s
 => [auth internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 284B                                                                                                                                            0.0s
 => [auth stage-0  1/20] FROM docker.io/dunglas/frankenphp:latest-php8.3-alpine@sha256:5bd857d2d22dc41f1e4c332f7f5cfc11a62b3ab9ebe4ec9f012c32f47acc47aa                      0.0s
 => [auth internal] load build context                                                                                                                                       0.1s
 => => transferring context: 35.05kB                                                                                                                                         0.1s
 => CACHED [auth] FROM breezemm.com/bun:latest                                                                                                                               0.0s
 => CACHED [auth stage-0  2/20] WORKDIR /var/www/html                                                                                                                        0.0s
 => CACHED [auth stage-0  3/20] RUN apk update;     apk upgrade;     apk add --no-cache      bash     curl     supervisor     nodejs     npm      libsodium-dev     librdka  0.0s
 => CACHED [auth stage-0  4/20] RUN install-php-extensions @composer-2.7.1                                                                                                   0.0s
 => CACHED [auth stage-0  5/20] RUN php -m                                                                                                                                   0.0s
 => CACHED [auth stage-0  6/20] RUN adduser -D -u 1000 -G www-data breeze                                                                                                    0.0s
 => CACHED [auth stage-0  7/20] COPY --chown=breeze:breeze ./packages/ ./packages/                                                                                           0.0s
 => CACHED [auth stage-0  8/20] COPY --chown=breeze:breeze ./composer.json ./composer.json                                                                                   0.0s
 => CACHED [auth stage-0  9/20] COPY --chown=breeze:breeze ./composer.lock ./composer.lock                                                                                   0.0s
 => CACHED [auth stage-0 10/20] COPY --chown=breeze:breeze  ./apps/auth ./apps/auth                                                                                          0.0s
 => ERROR [auth stage-0 11/20] RUN composer install --working-dir=./apps/auth                                                                                                0.2s
------
 > [auth stage-0 11/20] RUN composer install --working-dir=./apps/auth:
0.127 Installing dependencies from lock file (including require-dev)
0.131 Verifying lock file contents can be installed on current platform.
0.134 Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
0.143 Your lock file does not contain a compatible set of packages. Please run composer update.
0.143
0.143   Problem 1
0.143     - laravel/horizon is locked to version v5.24.4 and an update of this package was not requested.
0.143     - laravel/horizon v5.24.4 requires ext-pcntl * -> it is missing from your system. Install or enable PHP's pcntl extension.
0.143   Problem 2
0.143     - spatie/image is locked to version 3.5.0 and an update of this package was not requested.
0.143     - spatie/image 3.5.0 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.
0.143   Problem 3
0.143     - spatie/laravel-medialibrary is locked to version 11.4.7 and an update of this package was not requested.
0.143     - spatie/laravel-medialibrary 11.4.7 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.
0.143
0.143 To enable extensions, verify that they are enabled in your .ini files:
0.143     - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
0.143 You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
0.143 Alternatively, you can run Composer with `--ignore-platform-req=ext-pcntl --ignore-platform-req=ext-exif` to temporarily ignore these required extensions.
------
failed to solve: process "/bin/sh -c composer install --working-dir=${APP_PATH}" did not complete successfully: exit code: 2

@theaungmyatmoe
Copy link
Author

Here is dockerfile that can produce above issue.

**
WORKDIR ${WORK_DIR}

RUN apk update; \
    apk upgrade; \
    apk add --no-cache  \
    bash \
    curl \
    supervisor \
    nodejs \
    npm  \
    libsodium-dev \
    librdkafka-dev \
    g++ \
    make \
    autoconf \
    && apk del autoconf g++ make  \
    && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* \

RUN install-php-extensions \
        redis \
        rdkafka \
        exif \
        pdo_mysql \
        zip \
        sockets \
        pcntl \
        opcache \
        mongodb \
        gd \
        opcache \
        intl \
        bcmath


RUN install-php-extensions @composer-${COMPOSER_VERSION}


RUN php -m
**

@theaungmyatmoe
Copy link
Author

I am facing this issue today. It's working for a long time with mac m2 chip. I am using orbstack and tried to use docker desktop and same issue is still occured. So that I am revered back to the orbstack due to the perf and file system issue of docker desktop.

@theaungmyatmoe
Copy link
Author

docker version
Client:
Version: 25.0.5
API version: 1.44
Go version: go1.21.8
Git commit: 5dc9bcc
Built: Tue Mar 19 15:02:31 2024
OS/Arch: darwin/arm64
Context: orbstack

Server: Docker Engine - Community
Engine:
Version: 25.0.5
API version: 1.44 (minimum version 1.24)
Go version: go1.21.8
Git commit: e63daec
Built: Tue Mar 19 15:05:27 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: v1.7.17
GitCommit: 3a4de459a68952ffb703bbe7f2290861a75b6b67
runc:
Version: 1.1.12
GitCommit: 51d5e94601ceffbbd85688df1c928ecccbfa4685
docker-init:
Version: 0.19.0
GitCommit: de40ad0

@theaungmyatmoe
Copy link
Author

This can be related with #896? I am currently using

ARG PHP_VERSION=8.3
ARG FRANKENPHP_VERSION=latest

FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine

image and it pull the latest version of this installer.

https://github.com/dunglas/frankenphp/blob/3d065eda3587ceed32a132f11c3d97c7b57c0317/Dockerfile#L24

@mlocati
Copy link
Owner

mlocati commented May 25, 2024

From your log file it seems that install-php-extensions is not executed: the build process breaks before it's called.

If so, the issue is not related to install-php-extensions

@theaungmyatmoe
Copy link
Author

theaungmyatmoe commented May 25, 2024

I found it's platform compact issue btw. If i disable Rosetta in M2. It's working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants