Fix for mixed PHP+Node app build failures on DigitalOcean App Platform

I am using DigitalOcean App platform for a few of my side- and demo-projects, for example this blog engine or PHP RFC Watch. As side projects do, they don't get deployed often. When I wanted to deploy a new version of this blog, the build failed on DigitalOcean App platform during the deploy step with this error:

[2024-03-10 13:23:04] bash: line 1: vendor/bin/heroku-php-nginx: No such file or directory

The same error could also have been happening with the heroku-php-apache2 command, its just i am using Nginx in this project.

The problem seems that during the Build step, DigitalOcean does not detect automatically anymore that the project needs the PHP Buildpack. Instead it only runs the Node.js buildpack.

I found the fix in this StackOverflow post, you need to temporarily downgrade the buildpack stack on DO to Ubuntu-18, and then go back to Ubuntu-22.

To make this work, go to the "Settings" tab of your DO App platform project. Click "Edit" in the "App Spec" section and add the following two lines to the end:

    - buildpack-stack=ubuntu-18

After the deployment went through, edit this file again and change it to:

    - buildpack-stack=ubuntu-22
Published: 2024-03-10