1

I started up a new Laravel 5.0 Quick Start at OpenShift. The default laravel home page and auth pages worked just fine. I changed the OpenShift environment variables as follows:

> rhc env set APP_DEBUG=true
> rhc env set APP_ENV=development

Note the change to APP_DEBUG was inadvertent. I originally only meant to touch APP_ENV and then if I understand correctly the OpenShift action hooks should have set other environment variables accordingly. Still I suspect my problem described below would arise whether or not I make that mistake.

In any case after executing the two forgoing commands I can no longer restart. Failing like so:

> rhc app restart -a php
Failed to execute action hook 'pre_restart' for {id} application php
Failed to execute action hook 'pre_restart' for {id} application php

From the web interface I get this longer message:

Setting environment variables...
/usr/lib/openshift/cartridge_sdk/bash/sdk: line 154: /var/lib/openshift/{id}//.env/user_vars/APP_ENV: Permission denied


Setting environment variables...
/usr/lib/openshift/cartridge_sdk/bash/sdk: line 154: /var/lib/openshift/{id}//.env/user_vars/APP_ENV: Permission denied
Failed to execute action hook 'pre_restart' for {id} application php
Failed to execute action hook 'pre_restart' for {id} application php

I am early enough in setting this up that I could as a last resort start over from scratch. However I would like to understand the reliable way to change the environment variable from production to development and back. Also, what permissions are at work here and is there a way to manage them so that the action hooks do not encounter "permission denied?"

Thank you for any help. Please let me know if I can clarify anything.

1
  • I can say for sure that this also happens on a new instance of Laravel 5.0 quick start. I confirmed it could restart out of the box. Ran only the command to set APP_ENV=development. Afterward restart fails as described in the main question. Aug 13, 2015 at 14:14

1 Answer 1

1

To switch environments simply set the APPLICATION_ENV environment variable to development. Don't set APP_DEBUG and APP_ENV directly. Checkout the readme.md file accompanying the QuickStart: https://github.com/luciddreamz/laravel#development-mode

3
  • 1
    See also: developers.openshift.com/en/… Aug 13, 2015 at 14:48
  • @lucidedreamz Thanks. I have tried it that way and encountered the same problem re-starting (see my comment at about the same time you were answering) But, I have been able to successfully restart if I chmod APP_ENV to 664 I looked at the permissions for $OPENSHIFT_HOMEDIR/.env/.user_vars and noted that before updating APP_ENV it is owned by the application-id user. After the update and a restart it is owned by root. Aug 13, 2015 at 16:04
  • Ahh! I misread your comment originally. Got it now. Thanks! Aug 13, 2015 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .