Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Installation & Hosting

Grav on Heroku || Permission denied

Started by Kiril 9 years ago · 11 replies · 3672 views
9 years ago

Hello! I am trying to deploy Grav as a Heroku app but I get this error:

sh: 1: bin/grav: Permission denied

Script bin/grav install handling the compile event returned with error code 126

! Push rejected, failed to compile PHP app.

! Push failed

The full build log is:
`-----> PHP app detected

-----> Bootstrapping...

-----> Installing platform packages...

YAML
   NOTICE: No runtime required in composer.json; requirements

   from dependencies in composer.lock will be used for selection

   - php (7.1.8)

   - ext-mbstring (bundled with php)

   - apache (2.4.20)

   - nginx (1.8.1)

! WARNING: Your 'composer.lock' is not up to date with the latest

TXT
   changes in 'composer.json'. To ensure you are not getting stale

   dependencies, run 'composer update' on your machine and commit

   any changes to Git before pushing again.

-----> Installing dependencies...

YAML
   Composer version 1.4.2 2017-05-17 08:17:52

   Loading composer repositories with package information

   Installing dependencies from lock file

   Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.

   Package operations: 12 installs, 0 updates, 0 removals

     - Installing psr/log (1.0.2): Loading from cache

     - Installing monolog/monolog (1.22.1): Loading from cache

     - Installing symfony/routing (v3.2.7): Loading from cache

     - Installing symfony/polyfill-mbstring (v1.3.0): Loading from cache

     - Installing symfony/http-foundation (v3.2.7): Loading from cache

     - Installing symfony/event-dispatcher (v3.2.7): Loading from cache

     - Installing symfony/debug (v3.2.7): Loading from cache

     - Installing symfony/http-kernel (v3.2.7): Loading from cache

     - Installing pimple/pimple (v3.0.2): Loading from cache

     - Installing silex/silex (v2.0.4): Loading from cache

     - Installing twig/twig (v2.3.0): Loading from cache

     - Installing symfony/twig-bridge (v3.2.7): Loading from cache

   Generating optimized autoload files

-----> Running 'composer compile'...

TXT
   > bin/grav install

   sh: 1: bin/grav: Permission denied

   Script bin/grav install handling the compile event returned with error code 126

! Push rejected, failed to compile PHP app.

! Push failed`

Any help!

Thanks

9 years ago

Hi!
It seems that you don't have permission to run it. What user owns the files?
You can check it by running ls -l in the folder.

9 years ago

MakaryGo

rhuk

Thank you for the answers!!

Yes I follow the Heroku guide, and I think I made a mistake - I added all Grav files in the 'web' folder instead to delete it....

I am sorry... 🙂

Will try again!

Regards

9 years ago

Same result - I tried to deploy Grav again following the guide step by step but I get the same errors:

TXT
   sh: 1: bin/grav: Permission denied

   Script bin/grav install handling the compile event returned with error code 126

This is the second build log:

-----> PHP app detected

-----> Bootstrapping...

-----> Installing platform packages...

YAML
   - php (7.1.8)

   - ext-gd (bundled with php)

   - ext-mbstring (bundled with php)

   - apache (2.4.20)

   - nginx (1.8.1)

-----> Installing dependencies...

YAML
   Composer version 1.4.2 2017-05-17 08:17:52

   Loading composer repositories with package information

   Installing dependencies from lock file

   Package operations: 27 installs, 0 updates, 0 removals

     - Installing antoligy/dom-string-iterators (v1.0.0): Downloading (100%)

     - Installing doctrine/cache (v1.6.1): Downloading (100%)

     - Installing doctrine/collections (v1.3.0): Downloading (100%)

     - Installing donatj/phpuseragentparser (v0.7.0): Downloading (100%)

     - Installing erusev/parsedown (1.6.2): Downloading (100%)

     - Installing erusev/parsedown-extra (0.7.1): Downloading (100%)

     - Installing psr/log (1.0.2): Loading from cache

     - Installing filp/whoops (2.1.9): Downloading (100%)

     - Installing gregwar/cache (v1.0.12): Downloading (100%)

     - Installing gregwar/image (v2.0.21): Downloading (100%)

     - Installing seld/cli-prompt (1.0.3): Downloading (100%)

     - Installing league/climate (3.2.1): Downloading (100%)

     - Installing matthiasmullie/path-converter (1.1.0): Downloading (100%)

     - Installing matthiasmullie/minify (1.3.45): Downloading (100%)

     - Installing symfony/polyfill-mbstring (v1.4.0): Downloading (100%)

     - Installing symfony/var-dumper (v2.8.22): Downloading (100%)

     - Installing maximebf/debugbar (1.13.1): Downloading (100%)

     - Installing miljar/php-exif (v0.6.3): Downloading (100%)

     - Installing monolog/monolog (1.23.0): Downloading (100%)

     - Installing symfony/yaml (v2.8.22): Downloading (100%)

     - Installing symfony/event-dispatcher (v2.8.22): Downloading (100%)

     - Installing pimple/pimple (v3.0.2): Loading from cache

     - Installing rockettheme/toolbox (1.3.5): Downloading (100%)

     - Installing symfony/debug (v3.0.9): Downloading (100%)

     - Installing symfony/console (v2.8.22): Downloading (100%)

     - Installing symfony/polyfill-iconv (v1.4.0): Downloading (100%)

     - Installing twig/twig (v1.34.3): Downloading (100%)

   Generating optimized autoload files

-----> Running 'composer compile'...

TXT
   > bin/grav install

   sh: 1: bin/grav: Permission denied

   Script bin/grav install handling the compile event returned with error code 126

! Push rejected, failed to compile PHP app.

! Push failed

9 years ago

Hello again!

So I tried and this: I made a setup.php with:

BASH
#!/bin/sh
chown -R joeblow:staff .    
find . -type f | xargs chmod 664
find ./bin -type f | xargs chmod 775    
find . -type d | xargs chmod 775
find . -type d | xargs chmod +s    
umask 0002

But the result is still the same....

9 years ago

Could you please give us output of this command?

@MakaryGo:
What user owns the files?

You can check it by running ls -l in the folder.

9 years ago

MakaryGo
rhuk

Please accept my apologies - all problems above were because I did everything wrong - I tried to run Grav directly from GitHub (I don't have it running locally on my pc...) following the wrong part of the Grav documentation. Today I just cloned the Grav GitHub repository and added in composer.json

TXT
"scripts": {
  "compile": [
    "bin/grav install",
    "bin/gpm install admin -y",
    "bin/gpm install antimatter -y"
  ]

}

and I was able to deploy Grav on Heroku.

Regards

Kiril

9 years ago

Hi Guys,

I've read the https://learn.getgrav.org/webservers-hosting/paas/heroku, but I'm running into similar problems, trying to deploy to heroku.

composer.json

JSON
{
    "name": "getgrav/grav",
    "type": "project",
    "description": "Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS",
    "keywords": ["cms","flat-file cms","flat cms","flatfile cms","php"],
    "homepage": "http://getgrav.org",
    "license": "MIT",
    "require": {
        "php": ">=5.5.9",
        "twig/twig": "~1.24",
        "erusev/parsedown": "~1.6",
        "erusev/parsedown-extra": "~0.7",
        "symfony/yaml": "~2.8",
        "symfony/console": "~2.8",
        "symfony/event-dispatcher": "~2.8",
        "symfony/var-dumper": "~2.8",
        "symfony/polyfill-iconv": "~1.0",
        "doctrine/cache": "1.6.*",
        "doctrine/collections": "1.3",
        "filp/whoops": "~2.0",
        "matthiasmullie/minify": "^1.3",
        "monolog/monolog": "~1.0",
        "gregwar/image": "2.*",
        "donatj/phpuseragentparser": "~0.3",
        "pimple/pimple": "~3.0",
        "rockettheme/toolbox": "~1.0",
        "maximebf/debugbar": "~1.10",
        "ext-mbstring": "*",
        "ext-openssl": "*",
        "ext-curl": "*",
        "ext-zip": "*",
        "league/climate": "^3.2",
        "antoligy/dom-string-iterators": "^1.0",
        "miljar/php-exif": "^0.6.3",
        "composer/ca-bundle": "^1.0"
    },
    "require-dev": {
        "codeception/codeception": "^2.1",
        "phpunit/php-code-coverage": "~2.0",
        "fzaninotto/faker": "^1.5",
        "victorjonsson/markdowndocs": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/trilbymedia/PHP-Markdown-Documentation-Generator"
        }
    ],
    "autoload": {
        "psr-4": {
            "Grav\\": "system/src/Grav"
        },
        "files": ["system/defines.php"]
    },
    "archive": {
        "exclude": ["VERSION"]
    },
    "scripts": {
        "post-create-project-cmd": "bin/grav install",
        "test": "vendor/bin/codecept run unit",
        "test-windows": "vendor\\bin\\codecept run unit",
        "compile": [
            "bin/grav install"
        ]
    },
    "extra": {
        "branch-alias": {
            "dev-develop": "1.x-dev"
        }
    }
}

Procfile

TXT
web: vendor/bin/heroku-php-apache2 ./

I'm using the above compile scripts in composer.json but it didn't solve it, it still says permission denied.

Heroku deploy output:

YAML
remote: -----> Running 'composer compile'...
remote:        > bin/grav install
remote:        sh: 1: bin/grav: Permission denied
remote:        Script bin/grav install handling the compile event returned with error code 126
remote:  !     Push rejected, failed to compile PHP app.

Permissions ouput (locally)

TXT
$ ls -al
total 1796
drwxr-xr-x 1 ben 1049089       0 Sep 30 08:28 ./
drwxr-xr-x 1 ben 1049089       0 Oct  4 12:38 ../
-rwxr-xr-x 1 ben 1049089 1815925 Sep 30 08:28 composer.phar*
-rwxr-xr-x 1 ben 1049089    2171 Sep 30 08:28 gpm*
-rwxr-xr-x 1 ben 1049089    1408 Sep 30 08:28 grav*
-rwxr-xr-x 1 ben 1049089    4281 Sep 30 08:28 plugin*

What is going on here?
Any help would be much appreciated 🙂

Cheers,
Ben

9 years ago

I'm having this same problem, hopefully someone can help.

9 years ago

OK I'm posting this if some other people also face this problem. I think there is something wrong in the tutorial found from here, or then in the GitHub Heroku php-getting-started repo it suggests to clone. I don't know what it is but I tried to follow the tutorial several times and always got the permission denied problem. Perhaps someone could check the tutorial and see if there is something to fix.

Anyways, how I got it working was that I just cloned Grav repo to new folder, installed dependencies and ran heroku create. Then I created Procfile manually and entered web: vendor/bin/heroku-php-apache2 ./ there, added the compile scripts to composer.json then just committed changes and pushed to Heroku and it worked. Essentially did everything the tutorial tells you to do, except clone the Heroku php-getting-started repo and use it as a base for Grav installation.

👍 1
9 years ago

Thank you for this. Was struggling to get this to work.

I also added php to the compile commands which seem to resolve the permission errors:

TXT
"scripts": {
  "compile": [
    "php bin/grav install",
    "php bin/gpm install admin -y",
    "php bin/gpm install antimatter -y"
  ]
}
👍 1

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 12 hours ago
5 59 6 hours ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 61 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 61 8 months ago
Installation & Hosting · by N, 12 months ago
3 72 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 61 1 year ago