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

Setup certain PHP configs to be editable with environment variables #1

Open
jonpugh opened this issue Jun 17, 2015 · 4 comments
Open

Comments

@jonpugh
Copy link
Member

jonpugh commented Jun 17, 2015

I need to up the PHP memory limit. I don't want to hard code it into the container.

Let's figure out how to use an environment variable to set it.

@jlyon
Copy link

jlyon commented Jul 24, 2015

+1 for this

From http://stackoverflow.com/questions/858431/is-it-possible-to-use-environment-variables-in-php-ini:
According to the php manual you can access any env var in the php.ini via ${VARNAME}. – Marcus Pope Mar 17 '14 at 19:09

We'd need to make sure to set the default $PHP_MEMORY_LIMIT. Should this be done in terra-app?

@jonpugh
Copy link
Member Author

jonpugh commented Jul 29, 2015

Yep, environment vars are set here: https://github.com/terra-ops/terra-app/blob/master/src/terra/Factory/EnvironmentFactory.php#L305

To override for a specific app, we would use the docker-compose: overrides: app: environment: item in .terra.yml...

docker_compose:
  overrides:
    app:
      environment:
        PHP_MEMORY_LIMIT: 256MB

I'll need to test that the overrides behavior merges based on the environment name.

@jlyon
Copy link

jlyon commented Aug 6, 2015

After rebuilding docker-drupal with

memory_limit=${PHP_MEMORY_LIMIT}

I get a fatal PHP error. It seems like ${PHP_MEMORY_LIMIT} isn't getting set properly.

Allowed memory size of 262144 bytes exhausted (tried to allocate 4480 bytes) in /usr/share/nginx/html/includes/bootstrap.inc on line 201"

@jonpugh
Copy link
Member Author

jonpugh commented Aug 6, 2015

Did you add to the Docker file?

ENV PHP_MEMORY_LIMIT 128m

That will set the default environment variable.
On Aug 5, 2015 8:53 PM, "Jeff Lyon" [email protected] wrote:

After rebuilding docker-drupal with

memory_limit=${PHP_MEMORY_LIMIT}

I get a fatal PHP error. It seems like ${PHP_MEMORY_LIMIT} isn't getting
set properly.

Allowed memory size of 262144 bytes exhausted (tried to allocate 4480 bytes) in /usr/share/nginx/html/includes/bootstrap.inc on line 201"


Reply to this email directly or view it on GitHub
#1 (comment)
.

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