Question

Deployment stage failing due to heroku-php-apache2 problem

Posted August 18, 2021 148 views
PHPDigitalOcean App PlatformPaaS

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?

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.

×
Submit an Answer
1 answer

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.