mlocati / docker-php-extension-installer

Easily install PHP extensions in Docker containers
MIT License
4.18k stars 378 forks source link

install-php-extensions: 1830: PHP_INI_DIR: parameter not set #920

Closed Felipaorfr closed 4 months ago

Felipaorfr commented 4 months ago

Version of install-php-extensions

latest

Error description

My Dockerfile:

FROM php:7.1-apache
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN  install-php-extensions xdebug

The error I get: /usr/bin/install-php-extensions: 1830: /usr/bin/install-php-extensions: PHP_INI_DIR: parameter not set failed to solve: process "/bin/sh -c sudo install-php-extensions xdebug" did not complete successfully: exit code: 2

Error seems to be in this line 1830:

checkModuleWorking_iniFile="$PHP_INI_DIR/conf.d/docker-php-ext-$1--temp.ini"

Not sure what to do to fix this...

Docker image

php:7.1-apache

Minimal Dockerfile

FROM php:7.1-cli

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN  install-php-extensions xdebug
mlocati commented 4 months ago

That's really strange...

I launched a docker image with

docker run --rm -it php:7.1-apache bash

And I executed

$ echo $PHP_INI_DIR
/usr/local/etc/php

I don't know why in your case the PHP_INI_DIR environment variable is not set.

Felipaorfr commented 4 months ago

Just so you know: RUN pecl install xdebug-2.9.8 && docker-php-ext-enable xdebug whas also breaking with the same error. The fix was to change the version, for instance: RUN pecl install xdebug-2.9.1 && docker-php-ext-enable xdebug

And it worked, but I messed around so much with this that php -v and phpinfo() shows version 2.9.8. That's really strange.