I recently had to templatize PHP configurations using Ansible and Jinja2. I had to do some research to ensure that the memory directives that were being defined were actually valid. The three directives I was tinkering with were:
DevOps'ish is on hiatus and is not taking new subscribers at this time. Stay tuned to Chris Short's web site for details on future projects and when DevOps'ish will relaunch.Thank you to all subscribers for your years of support.
These three directives values’ are actually tied together. memory_limit is the max amount of memory that a script can consume. upload_max_filesize defines the largest size a file upload can be. post_max_size limits the max size of post data.
It’s not until you read the documentation on post_max_size that it is clearly laid out that these three directives are related:
This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.
To summarize, memory_limit must be greater than post_max_size and if your uploading files with a POST method post_max_size should be greater than upload_max_filesize.
post_max_size > upload_max_filesize memory_limit > post_max_size
memory_limit > post_max_size > upload_max_filesize