Bitbucket Pipeline Now Using Packaged Version
Asked by kurtwolf:

I have a custom Docker image built with PHP 8.1 and a specific version of node (14). The pipeline executes however error's out that it is using php 8.0 instead of 8.1. I'm not sure where this older version of PHP is coming from.

```
image: itguy614/gohcl-php-docker-pipeline:php-8.1pipelines:  branches:    develop:      - step:          name: Composer Build          script:            - cp -v .env.example .env            - composer config --global --auth http-basic.repo.gohcl.com $PACKAGIST_USER $PACKAGIST_TOKEN            - composer config repositories.private-packagist composer https://repo.gohcl.com/gohcltech/            - composer config repositories.packagist.org false            - composer install --no-interaction --no-progress --prefer-dist            - php artisan key:generate          artifacts:            - vendor/**            - .env
```

Build error message:  
Problem 1  
- Root [composer.json](https://bitbucket.org/gohcl/worthington/src/691af90eee44cf84b32344c32cb8ff1df50f42f2/composer.json) requires php ^8.1 but your php version (8.0.16) does not satisfy that requirement.


Answers:
author: Theodora Boudale
body: Hi [@kurtwolf](/t5/user/viewprofilepage/user-id/4337404),

Since the Docker image is public, I ran a Pipelines build using this image as a build container and included the command *php --version* at the beginning of the build's script. The output shows PHP 8.1.3, same as locally.

Have you perhaps configured a different version of php in the composer.json file or any other configuration file of your repo?

I would suggest debugging the build locally first, so you don't consume Pipelines minutes for that. You can do so the following way:

**1.** Take a new clone of the develop branch of the repo on your machine

**2.** Navigate to the directory of that new clone, and do a **git reset --hard** to the commit of the failed build with the issue (if it's not the latest commit)

**3.** Afterwards, start a Docker container with the following command

```
docker run -it --volume=/Users/myUserName/code/my-repo:/localDebugRepo --workdir="/localDebugRepo" --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/bash itguy614/gohcl-php-docker-pipeline:php-8.1
```

Replace **/Users/myUserName/code/my-repo** in the command with the path of the clone you took on step 1.

After the Docker container starts, you can run the commands of your yml file's script.

If you get the same error, you can check composer.json or any other configuration files where a different version of php may be defined, make changes in these files locally and then run your build's commands again to see if the issue is resolved.

Kind regards,  
Theodora

comments: author: kurtwolf
body: Your information for debugging got me heading down the right path, thank you. I had installed composer using \`apk\` which has a built in dependency of php8.0 even though I'm using the official php8.1 image. I instead manually installed composer into my image and things started clicking.

Thank you very much.


author: Theodora Boudale
body: Thank you for the update [@kurtwolf](/t5/user/viewprofilepage/user-id/4337404), you are very welcome and I'm glad that you figured this out.

Please feel free to reach out if you ever need anything else!

Kind regards,  
Theodora


author: kurtwolf
body: This is from the Docker console for that image so you can see the installed versions.

![Screen Shot 2022-03-01 at 9.41.03 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/185873i15F1E24545FE3916/image-size/large?v=v2&px=999 "Screen Shot 2022-03-01 at 9.41.03 AM.png")


Tags: bitbucket-cloud

cloud