I have a server where PHP memory_limit is 256M. Some scripts need more memory and does a ini_set('memory_limit', '256M'); but since Suhosin is installed and activated, I find this in log file
Sep 17 14:06:42 www-01 suhosin[28934]: ALERT - script tried to increase memory_limit to 536870912 bytes which is above the allowed value (attacker '127.0.0.1', file '/xxx/generate_docs.php', line 45)
But suhosin is configured with
suhosin.memory_limit = 2048M
Both PHP memory_limit and suhosin.memory_limit values are confirmed by phpinfo(). Why PHP can't ask for more memory with this setup?
This script run fine for any memory limit value under 256M, but for a higher value I got the error and memory_limit don't change.
<?php
echo ini_get('memory_limit') . "<br>";
ini_set('memory_limit', '512M');
echo ini_get('memory_limit') . "<br>";
echo ini_get('suhosin.memory_limit') . "<br>";
echo "end<br>";
the output is
256M
256M
2048M
end
Alleluia. Asking a question help me to find the problem.
By setting suhosin.memory_limit to 1024 (2048 was for testing with an edge value), it run, and my script tells me
Same problem as https://stackoverflow.com/questions/9276212/php-settings-memory-limits-1024m-does-not-work/16854780#16854780 (same server, by the way)