Deployment stage failing due to heroku-php-apache2 problem

Hi everyone. As part of the project I’m building, i’ve started adding some composer dependencies. This is what my composer.json file looks like:

    "require": {
        "vlucas/phpdotenv": "^5.3"
    "config": {
        "vendor-dir": "build/assets/php/vendor"

Ever since adding this (it used to be an empty json object), after the build process finishes, the deployment fails with the following error:

heroku-php-apache2: command not found

I’m using webpack to build my site in a folder called build:

  • webpack --mode production && composer update

and then the run command is set as heroku-php-apache2 build/. This is where the above error occurs:

heroku-php-apache2: command not found

Bit stumped on this. Is my composer.json file missing some specific information 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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @brownjohno1993!

I tried to replicate this by adding the config/vendor-dir option to my app’s composer.json but it still deployed successfully. I did notice that the heroku-php-apache2 executable was placed in build/assets/php/vendor instead of its default location, but the $PATH environment variable was also updated to reflect the new path.

To further troubleshoot this, can you update your run command to the following:

which heroku-php-apache2
echo $PATH
find . -name heroku-php-apache2
heroku-php-apache2 build/

The first three commands will print some diagnostic info about the heroku-php-apache2 executable and the fourth command will attempt to start your app just in case it works.

You can also try to clear the build cache and redeploy your app. To do this in the control panel, navigate to your app, click the Actions menu, and then select Force Build and Deploy. In the Force Build and Deploy window, select the Clear Build Cache option, and then click on the “Deploy” button. This clears the build cache and starts a new deployment.