Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing post-install-cmd commands from composer.json #2

Open
adamgoose opened this issue Sep 25, 2013 · 4 comments
Open

Executing post-install-cmd commands from composer.json #2

adamgoose opened this issue Sep 25, 2013 · 4 comments

Comments

@adamgoose
Copy link

The default composer.json provided by laravel has the following scripts:

"scripts": {
        "post-install-cmd": [
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },

However, php is not available, thus the push fails. I tried using $BUILD_DIR/bin/php, since that's what you use in the compile script to execute composer, however apparently $BUILD_DIR is empty when composer executes these functions because I receive the following error messages.

sh: /bin/php: not found
Script $BUILD_DIR/bin/php artisan optimize handling the post-install-cmd event returned with an error

How might I go about modifying the composer.json provided by Laravel so that it can successfully execute artisan commands via the json file?

@adamgoose
Copy link
Author

I was able to solve my issue by the following steps.

  1. I told composer.json to run env on pre-install-cmd, revealing that the environment variable _ points to the php in the build directory's bin.
  2. I updated composer.json and replaced php with $_

Thanks for a great buildpack!

@adamgoose
Copy link
Author

I have written a tutorial using this build pack, if you'd like to refer to it you your README.md.

https://blog.enge.me/post/a-comprehensive-tutorial-for-deploying-laravel-4-on-heroku

@adamgoose
Copy link
Author

Is there a way to export PATH=$PATH:/app/bin during the installation so that I don't have to use the workaround mentioned above?

@adamgoose adamgoose reopened this Nov 14, 2013
@winglian
Copy link
Owner

I haven't run into this issue before and I use laravel pretty extensively with this buildpack. If anything PATH is set during the compile phase here https://github.com/winglian/heroku-buildpack-php/blob/mpm-event-php55-fpm/bin/compile#L52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants