Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '', 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.

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

share|improve this question
As exmplained in the documentation the suhosin value is a hard limit, while php's value is a soft limit. See:… – symcbean Mar 31 '14 at 13:15
My question is : if suhosin HARD limit is 2048, why I can't set php memory SOFT limit higher than 256M ? There is a clear bug when I set suhosin limit to 2048M. See my answer below. – Cédric Girard Apr 1 '14 at 13:39
Because the you can't set a soft limit higher than a hard limit by definition – symcbean Apr 1 '14 at 14:55
The HARD limit is 2048M, but the SOFT limit can't be higher than 256M. 2048M is greater than 256M or event 512M, in my mind. – Cédric Girard Apr 2 '14 at 11:49
up vote 1 down vote accepted

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 (same server, by the way)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.