---
title: "What should I do when encountering a PHP version error during code build?"
date: "2025-05-27T09:43:25+00:00"
summary: "Resolve PHP version errors during code build by setting the correct PHP_VERSION environment variable in Code Studio UI."
image:
type: "article"
url: "/acquia-cloud-platform/add-ons/code-studio/help/69306-what-should-i-do-when-encountering-php-version-error-during-code-build"
id: "fea25798-5b9e-4736-86d6-502811852d4b"
---

**Description**

**Build stage**

**Job**

**Error message**

**Category**

**Responsibility**

[Build Drupal](https://docs.acquia.com/acquia-cloud-platform/add-ons/code-studio/docs/customizing-code-studio/drupal-auto-devops/autodevops-jobs#section-build-drupal-stage)

[Build Code](https://docs.acquia.com/acquia-cloud-platform/add-ons/code-studio/docs/customizing-code-studio/drupal-auto-devops/autodevops-jobs#section-build-code-job)

`Your lock file does not contain a compatible set of packages. Please run composer update.`

`symfony/string vx.x.x requires php >=8.2 -> your php version (8.1) does not satisfy that requirement.`

Application

Customer

**Potential cause**

The PHP version of the project is not set correctly.

**Solution**

Add the `PHP_VERSION` environment variable to your project through the UI, and set its value to the PHP version that your project uses. This value accepts major and minor versions only, for example, 8.2. For more information, see [Modifying environment variables](https://docs.acquia.com/acquia-cloud-platform/add-ons/code-studio/customizing-code-studio/default-code-studio-pipeline/environment-variables#section-modifying-environment-variables).

Note

Setting the `PHP_VERSION` variable in the `.gitlab-ci.yml` file might not work as expected. Acquia recommends that you set variable values through the Code Studio UI.

The `composer.json` file in your project, [Cloud IDE](https://docs.acquia.com/acquia-cloud-platform/add-ons/ide), [Code Studio](/acquia-cloud-platform/add-ons/code-studio/overview "Overview"), and [Cloud Platform](/acquia-cloud-platform/overview "Overview") must use the same PHP version.