requires php ^7.4 -> found php[8.1.6, ..., 8.2.11] but it does not match the constraint.

My deployment on app platform with my Laravel app was working recently but now, its throwing me an error

composer.json/composer.lock requires php ^7.4 -> found php[8.1.6, …, 8.2.11] but it does not match the constraint.

Looking at the deployment error, in my understanding, seems it found php8.1.

I specify php version 7.4 on the composer json

    "name": "ddf/test",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
    "license": "MIT",
    "require": {
        "php": "^7.4",
        "ext-bcmath": "*",
        "ext-ctype": "*",
        "ext-fileinfo": "*",
        "ext-json": "*",
        "ext-mbstring": "*",
        "ext-openssl": "*",
        "ext-pdo": "*",
        "ext-tokenizer": "*",
        "ext-xml": "*",
        "ext-curl": "*",
        "ext-exif": "*",
        "ext-gd": "*",

why its pointing to php8? any ideas how to resolve this issue? I’m stuck on this for days now.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 11, 2023

Hi there,

Have you by any chance tried to do a forced-redeployment so that you could clear the build cache?

If the above does not help, it is possible that PHP 7.x might not be available with the new Ubuntu 22 buildpack on the App Platform. What you could do in this case is:

  1. Downgrade to Ubuntu 18: By modifying your app spec, you can revert to using Ubuntu 18, which should restore compatibility for your application. You can follow the instructions here: How to Change Stack.

  2. Upgrade Your Software: If you’re keen on benefiting from the updates in Ubuntu 22, consider upgrading your software versions. Afterwards, ensure you select the correct build pack supported in the Ubuntu 22 stack. The guide on how to do this can be found here: How to Upgrade Buildpacks.

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel