Skip to content

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

Merged
marji merged 4 commits into8.2from
8.2-memory
Jan 31, 2024
Merged

Allow to specify PHP memory_limit (128M default).#16
marji merged 4 commits into8.2from
8.2-memory

Conversation

@naveenvalecha
Copy link
Copy Markdown
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).

@naveenvalecha naveenvalecha requested a review from marji January 30, 2024 14:04
Copy link
Copy Markdown
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
Copy Markdown
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
@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