Anybody know how to increase the amount of RAM PHP can use on the App Platform?
I’ve read this discussion post but the recommendation to add “php_memory_limit” to the .user.ini doesn’t work. Assuming they meant memory_limt, that only changes how much each worker can consume, not the total allocation.
For example, in our .user.ini file we specify the following:
memory_limit = 32M
Our deployment logs show the following:
Assuming 512MB of RAM PHP memory_limit is 32M Bytes Starting php-fpm with 16 workers...
This would make sense if we only had 512MB of ram but we’re on the professional-xs which is 1GB of RAM and a 1 shared CPU. It’s only utilizing half of our total RAM. In addition to that, increasing the memory_limit decreases the total workers created. The formula DOAP uses to calculate workers is: 512MB / memory_limit or 128M if not specified in the .user.ini file.
How do we increase the total RAM PHP can use?
What confuses us more is, if we deploy the same repository as the professional-xl which comes with 16GB of RAM and 4 Dedicated CPUs, it STILL only uses 512MB of RAM. What’s the point of vertical scaling if it doesn’t increase the RAM allocation towards PHP? You could be paying $12 a month or $300 a month and the performance for PHP would be the SAME!
We’ve also tried adjusting the WEB_CONCURRENCY variable but that has no effect on increasing the 512MB limit.
What are we missing?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
I’m happy to share that we have fixed this issue and PHP apps now scale correctly per the selected instance sizes.
Please be sure to remove any custom
WEB_CONCURRENCYconfigs that were suggested before as a workaround.
I’ll post an answer from Steve from our community:
You can add a
.user.inifile to your codebase with something like
memory_limit=512Min it to set an explicit memory limit. Alternatively you could update your run command to be prefixed with an equivalent
echo 'memory_limit=512M' > .user.ini &&. Unfortunately, setting the
COMPOSER_MEMORY_LIMITenvironment variable isn’t currently working as you’d expect in the PHP buildpack.
You can check this question where this was originally posted: