Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measure maximum PHP memory usage

Setting php_value memory_limit always involves a bit of guesswork and I myself tend to use higher than necessary values just to make sure that the odd memory hungry call does not result in a fatal error.

Still, I am looking for a shell script that would behave kind of like htop or top but instead of showing the current values it would remember only the maximum memory consumed by a PHP script and retain it. Such value, over a few days, would be a very valuable indicator of what php_value memory_limit should be set to. Does something like that exist?

like image 703
Vacilando Avatar asked Apr 16 '26 13:04

Vacilando


1 Answers

What about saving the value returned by memory_get_peak_usage in a database/file?

like image 154
CodeZombie Avatar answered Apr 18 '26 06:04

CodeZombie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!