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

Ensure that correct PHP version is symlinked #53

Merged
merged 2 commits into from
Feb 23, 2022
Merged

Ensure that correct PHP version is symlinked #53

merged 2 commits into from
Feb 23, 2022

Conversation

elliotmassen
Copy link
Contributor

This PR fixes laradock/laradock#3133 by ensuring that the correct PHP version is symlinked. As noted in my comment on the issue it seems that there is an indirect dependency on PHP 8.1 during the installation of the PHP 8.0 packages. This causes both PHP 8.0 and PHP 8.1 to be installed, and for 8.1 to take priority in the php virtual package. The fix in this PR re-sets the virtual package to use PHP 8.0 instead, which then restores the image's expected behaviour.

This issue seems to be affecting the CI job for testing the build of PHP 8.0 workspace, so this fix should resolve that failure. It looks like this issue could also be affecting the other workspace jobs for previous PHP versions, however I haven't been able to validate that locally. If this is the case, I imagine that a similar fix in each of the previous Dockerfile's could resolve that too (ie. in Dockerfile-7.4: update-alternatives --set php /usr/bin/php7.4, etc).

I suppose that this fix could instead be applied in laradock/laradock's workspace/Dockerfile as RUN update-alternatives --set php /usr/bin/php${LARADOCK_PHP_VERSION} - however, as it seems a more fundamental fix I figured it might be better placed here in the base image itself.

Please feel free to amend this PR as necessary.

@tancou
Copy link

tancou commented Feb 14, 2022

Hi

I found the one that installs php8.1
https://stackoverflow.com/questions/70834073/php8-0-dev-package-installs-php-8-1-dependencies

Installing pkg-php-tools as Recommends of php8.0-dev
     Installing php-json as Depends of pkg-php-tools
       Installing php8.1-phpdbg as Depends of php-json
         Installing php8.1-cli as Depends of php8.1-phpdbg
           Installing php8.1-common as Depends of php8.1-cli
           Installing php8.1-opcache as Depends of php8.1-cli
           Installing php8.1-readline as Depends of php8.1-cli

bestlong Could you approve the CI for that PR, I ran it on my own fork and everything build

I suggest to append && php --version | grep -q "PHP 8.0" \ in order to be sure the php 8.0 is used.

   && apt-get clean \
    && update-alternatives --set php /usr/bin/php8.0 \
    && php --version | grep -q "PHP 8.0" \
    #####################################

When I just add && php --version without this PR, we can see that php 8.1 is installed and used by default.

@tancou
Copy link

tancou commented Feb 14, 2022

We can also improve every Dockerfile in order to check that the php version used by default matches with the php version defined in the Dockerfile.

We can also suggest checking every extension with a php -m | grep -q <extension>

@tancou
Copy link

tancou commented Feb 14, 2022

I found the package using this trick Debug::pkgDepCache::AutoInstall=true to list the tree of dependencies :

    && apt-get install -y --allow-downgrades --allow-remove-essential \
        --allow-change-held-packages \
        -o Debug::pkgDepCache::AutoInstall=true \

Then I looked for "8.1" string in CI logs.

@elliotmassen
Copy link
Contributor Author

@bestlong Thanks for running the checks. It looks like the failures are related to some missing Docker Hub data for the actions - which I think are unrelated to the changes in this PR. In any case, let me know if there's any changes to be made here.

@bestlong bestlong merged commit 0044eba into laradock:master Feb 23, 2022
@bestlong
Copy link
Member

relate #54

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

Successfully merging this pull request may close these issues.

Cannot build PHP 8.0
3 participants