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

Fpm-alpine php 8.2 is broken #839

Closed
anver opened this issue Aug 2, 2023 · 8 comments
Closed

Fpm-alpine php 8.2 is broken #839

anver opened this issue Aug 2, 2023 · 8 comments

Comments

@anver
Copy link

anver commented Aug 2, 2023

On a fresh install of provided fpm-alpine php 8.2, visiting the site says

Your PHP installation appears to be missing the MySQL extension which is required by WordPress. php 8.2
@tianon
Copy link
Member

tianon commented Dec 12, 2023

Sorry for the delay 😬

Is this still applicable? I can't seem to reproduce. 😕

@tianon
Copy link
Member

tianon commented Dec 12, 2023

(A minimal reproducer would be useful 🙈)

@anver
Copy link
Author

anver commented Dec 14, 2023

It still exists but this time i used alpine php 8.3 image instead of 8.2

image

@tianon
Copy link
Member

tianon commented Dec 14, 2023

Where should I browse in the UI to see that? I've just deployed wordpress:php8.3-fpm-alpine locally with NGINX in front (NGINX config from https://gist.github.com/md5/d9206eacb5a0ff5d6be0), and it seems to be working fine. 🙈

image

@tianon
Copy link
Member

tianon commented Dec 14, 2023

$ docker exec -i wordpress_wordpress_1 php -i | grep mysqli
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
mysqli
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.local_infile_directory => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.rollback_on_cached_plink => Off => Off
API Extensions => mysqli

@hktr92
Copy link

hktr92 commented Dec 26, 2023

It seems that the image itself doesn't contain PDO_MYSQL extension at all: https://github.com/docker-library/wordpress/blob/master/Dockerfile.template#L76-L82, thus breaking WooCommerce using this image.

However, as a workaround, you can override the base image:

FROM wordpress:6-php8.3-fpm-alpine AS wp-base

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions pdo pdo_mysql

For simplicity, just put it where you have the docker-compose.yml file and, for clarity, name it Dockerfile.wordpress.

And inside your docker-compose.yml, replace the following code where you have image: wordpress:

    build:
      dockerfile: Dockerfile.wordpress
    ...

@tianon
Copy link
Member

tianon commented Jan 2, 2024

It seems that the image itself doesn't contain PDO_MYSQL extension at all: ...

Correct; that is intentional: https://hub.docker.com/_/wordpress#:~:text=This%20image%20does%20not%20provide%20any%20additional%20PHP%20extensions%20or%20other%20libraries%2C%20even%20if%20they%20are%20required%20by%20popular%20plugins%20(e.g.%20it%20cannot%20send%20e%2Dmails).

This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins (e.g. it cannot send e-mails). There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.

If you need additional PHP extensions, you'll need to create your own image FROM this one. The documentation of the php image explains how to compile additional extensions. Additionally, an older Dockerfile for wordpress has a simplified example of doing this and a newer version of that same Dockerfile has a much more thorough example.

@yosifkit
Copy link
Member

yosifkit commented Jul 2, 2024

Closing, since any extra PHP extensions needed by WordPress plugins must be installed by the user.

@yosifkit yosifkit closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants