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

PHP 8.2 not working #104

Open
DanielMcAssey opened this issue Jul 28, 2023 · 5 comments
Open

PHP 8.2 not working #104

DanielMcAssey opened this issue Jul 28, 2023 · 5 comments

Comments

@DanielMcAssey
Copy link

DanielMcAssey commented Jul 28, 2023

Hey trying to use GitHub actions with a composer dependency to php 8.2, I get the following in the action:

Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.2-1ubuntu2.13.

PHP Fatal error:  Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.2-1ubuntu2.13

This is the action

      - name: Install dependencies
        uses: php-actions/composer@v6
        with:
          php_version: '8.2'
          php_extensions: gd zip sodium intl soap bcmath
          dev: yes
@g105b
Copy link
Member

g105b commented Jul 28, 2023

Thanks for the info. Looking into it for you.

@ArturVRSampaio
Copy link

+1

@AlexSkrypnyk
Copy link

Bumping this as PHP 8.1 active support ended a couple of weeks ago and this now blocks updates to 8.2 in consumer projects

@AlexSkrypnyk
Copy link

So I had a close look into this action. Everything is working correctly. The version specified in the argument is correctly installed into a short-lived Docker container.

The reason why we receive the error is conceptual: we are using this package incorrectly. :)

This action runs in the runner container and starts it's own container where it runs composer commands. Then, that container is removed. The version of php in your runner container (the one you specify in runs-on: ubuntu-latest) is what comes out-of-the-box with ubuntu-latest and, most likely, is not what you want. The version of PHP you specify for this action applies only to the container this action creates, it has no effect on the "runner" container.

This action is intended to be used in conjunction with other actions that all perform their activities in the separate docker containers that are started and stopped after each action execution.

If you want to install php version on the runner itself, you would use shivammathur/setup-php action instead.

Before:

- uses: php-actions/composer@v6

after

- uses: shivammathur/setup-php@v2
- run: composer install

Similar question was asked an answered in #111

@g105b
Maybe it is worth putting an explanation into README.md file so that people would be informed about specifics of the running actions like this in the separate short-lived container.

@g105b
Copy link
Member

g105b commented Dec 15, 2023

Thank you for your detailed write up @AlexSkrypnyk - I agree with you. I will write some documentation that addresses this, because I think most new issues submitted here are to do with running something on the native PHP. I wonder if there's a better way to do this altogether, like link the php binary to the one inside the php-actions container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants