-1

I would like to push a new app to Heroku using git push heroku master.

After successful authentication have got following error.

remote: Building source: remote: remote: -----> Fetching set buildpack
git://github.com/CHH/heroku-buildpack-php... done remote:

remote: !Push rejected, failed to detect set buildpack
git://github.com/CHH/heroku-buildpack-php

detect file:

#!/bin/bash

if [ -f "$1/composer.lock" ]; then
    echo "PHP (composer.json)" && exit 0
elif [ -f "$1/index.php" ]; then
    echo "PHP (classic)" && exit 0
else
    exit 1
fi
plaidshirt
  • 5,189
  • 19
  • 91
  • 181

2 Answers2

1

The first step would be to check the detect file in the buildpack for the requirements it is checking against. Any condition that causes it to exit 1 will cause Heroku to report a push rejection.

s.ash
  • 21
  • 3
  • 1
    Assuming, you have `composer.lock` and `index.php` in the project root directory (make sure), check if the project folder structure is correctly presented to heroku when you push i.e. not having the app root buried in a subfolder. Buildpacks for a particular language/framework expect to find the necessary files in the root to consider it a valid app. For example in a `node` app, every buildpack looks for a `package.json` in the root. – s.ash Apr 04 '16 at 17:34
  • I have cloned this project, so I haven't `index.php` in project root only `composer.lock`. – plaidshirt Apr 04 '16 at 17:57
  • Given the elif condition you should be find with having either one of the files. – s.ash Apr 04 '16 at 19:00
  • So isn't causes this the problem? – plaidshirt Apr 04 '16 at 21:05
  • Your logs don't show any messages from the compile script so I would make sure the folder structure is correct first. – s.ash Apr 04 '16 at 23:17
  • I have copied also `index.php` in root folder, but same error again. Nothing changed. – plaidshirt Apr 06 '16 at 20:08
  • I took a look at the buildpack, If there are no more log messages, something like `Bundling NGINX ${NGINX_VERSION}` then it is failing on the detect script because the compile scripts have a few log messages it should print out . If you have other error messages, show them here. If you are willing, fork the buildpack repo and put in some log messages where it starts the compilation process in the compile script at line [267](https://github.com/CHH/heroku-buildpack-php/blob/master/bin/compile#L267) and see if it reaching there at all. – s.ash Apr 08 '16 at 00:42
  • Also here is the [Heroku docs](https://devcenter.heroku.com/articles/buildpacks) on the error message. "This situation may also occur if you remove or rename a file that previously led to the automatic detection of your application type and thus the automatic setting of the detected buildpack on your application." – s.ash Apr 08 '16 at 00:52
  • It says about a file, but I cannot locate it. `Script error in /tmp/buildpack20160408-162-rmvmk4/bin/compile on or near line 380` – plaidshirt Apr 08 '16 at 05:22
  • This answer is *wrong*. The `detect` script fails unless it exits with 0: https://devcenter.heroku.com/articles/buildpack-api#bin-detect – Thiago Figueiro May 05 '16 at 01:20
0

This buildback is deprecated, you should use official Heroku buildpack instead.

plaidshirt
  • 5,189
  • 19
  • 91
  • 181