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

Allow to specify PHP memory_limit (128M default). #16

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Allow to specify PHP memory_limit (128M default). #16

merged 4 commits into from
Jan 31, 2024

Conversation

naveenvalecha
Copy link
Contributor

@naveenvalecha naveenvalecha commented Jan 30, 2024

Allow to pass in env variable PHP_MEMORY_LIMIT with desired memory_limit.
The 128MB is the default (as it has been until now).

Copy link
Member

@marji marji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we could use
ARG PHP_MEMORY_LIMIT=512M instead of
ENV PHP_MEMORY_LIMIT=512M
but I guess no harm to have that variable available in the container (though it is not used for anything).
LGTM

@marji
Copy link
Member

marji commented Jan 31, 2024

Actually, I have parametrised the /usr/local/etc/php/conf.d/memory-limit.ini - instead of writing in the value of the PHP_MEMORY_LIMIT variable on build time, I'm using the variable - as per https://www.php.net/manual/en/configuration.file.php


Example #1 php.ini Environment Variables

; PHP_MEMORY_LIMIT is taken from environment
memory_limit = ${PHP_MEMORY_LIMIT}

This means the 512M is the default value, but we can redefine it when creating the container, e.g.:

$ docker run --rm -ti --env PHP_MEMORY_LIMIT=256M  ghcr.io/morpht/ci-php:review-pr-16-8.2-memory /bin/bash 
ea2b06b6bf51:/$ php -i | grep memory_limit
memory_limit => 256M => 256M

@marji marji merged commit 0046040 into 8.2 Jan 31, 2024
1 check passed
@marji marji deleted the 8.2-memory branch January 31, 2024 06:16
@marji marji changed the title 8.2: Set PHP memory_limit to 512M. Allow to specify PHP memory_limit (128M default). Jan 31, 2024
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

Successfully merging this pull request may close these issues.

2 participants