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

Too less information about memory_limit #846

Open
ben221199 opened this issue Jun 4, 2024 · 1 comment
Open

Too less information about memory_limit #846

ben221199 opened this issue Jun 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ben221199
Copy link

Describe you feature request

Is your feature request related to a problem? Please describe.
I see some people here talking about memory_limit. Some of them use -1. Mine is by default set to 128M. At the moment I don't see any information about it on the website/documentation or in this repository. The memory_limit is a limit per request. Does this mean that it is the maximum memory for a worker too, because it is a long running request. What is the best value for it in production? What is the best value for it in a Docker container (maybe in combination with a Docker container memory limit)? Also, wouldn't it be nice if we can set it with an environment variable out of the box (e.g. PHP_MEMORY_LIMIT or PHP_WORKER_MEMORY).

Describe the solution you'd like
I want memory_limit covered in the documentation. Possibly I want to be able to set it using a environment variable without having to do much myself.

Describe alternatives you've considered
For now I consider setting memory_limit to -1 in production using a .ini file. I limit my Docker container to 384 MB or 512 MB.

@ben221199 ben221199 added the enhancement New feature or request label Jun 4, 2024
@dunglas
Copy link
Owner

dunglas commented Jun 4, 2024

I'll add some docs but it works "as expected". The limit is per request/worker. If it is reached, the worker restarts and an error is logged.

You can use ini_set('memory_limit', 'value'); to change the limit dynamically (as usual), the limit is automatically reset to the one defined in php.ini after the handling of each request.

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

No branches or pull requests

2 participants