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

Request: Alpine Version should use the native paths #380

Closed
symball opened this issue Feb 25, 2017 · 2 comments
Closed

Request: Alpine Version should use the native paths #380

symball opened this issue Feb 25, 2017 · 2 comments

Comments

@symball
Copy link

symball commented Feb 25, 2017

I'm referring to at least the Alpine PHP-FPM 5.6 version here

I've just switched over from the Debian version to the Alpine Linux and was having some trouble compiling the extensions but know there are already a set of packages available in the Alpine repository for the majority of extensions needed.
After trying to install them from there, my app was complaining about a lack of extensions and investigation shows that it was because PHP is expecting the following paths

config - /usr/local/etc/php
extensions - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/

Alpine Linux on the other hand installs to a much saner
config - /etc/php5
extensions - /usr/lib/php5/modules

What I have ended up doing with my dockerfile (because docker-php-ext-* rarely works) is just to remove the originals and symlink the Alpine paths using the following:

  RUN rm -R /usr/local/etc/php && \
    rm -R /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
  RUN mkdir -p /usr/local/lib/php/extensions
  RUN ln -s /etc/php5 /usr/local/etc/php && \
    ln -s /usr/lib/php5/modules /usr/local/lib/php/extensions/no-debug-non-zts-20131226

With the situation explained, I have 2 questions:

  1. Is there a reason these awkward paths are chosen?
  2. If not, can the paths in the image be set to what Alpine would natively use? It's installation method is much simpler than the aforementioned docker function

Is there a reason these particular directories were chosen?

@mathroc
Copy link
Contributor

mathroc commented May 12, 2017

I think this is wanted, extensions built by alpine might not be compatible with the php binary inside the image. you are expected to build the extension in the Dockerfile and not install them from alpine

if you want to use "native" alpine built extesion you're better off using the alpine image directly instead of the php:alpine image and install both php and the extensions from alpine

@tianon
Copy link
Member

tianon commented Dec 22, 2017

Indeed, as noted, this is definitely intentional. Not only are these paths the defaults that the PHP ./configure script uses given --prefix=/usr/local, but it's also important that any additional extensions be compiled against the appropriate version of PHP, and thus installing extensions from distribution packages is heavily discouraged and likely to lead to trouble (see #542 for a recent change which actively blocks exactly that in Debian-based images).

@tianon tianon closed this as completed Dec 22, 2017
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

3 participants