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?