Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
572 views
in Technique[技术] by (71.8m points)

memory limit - PHP : settings memory_limits > 1024M does not work

For bads reasons I need to set memory_limits higher than 1G for a directory, but on my PHP 5.2.17 on Lenny server when I put for example 2048M I get only the php.ini default value (256M).

PHP run as an apache module, phpinfo give us (for the directory)

memory_limit    1024M   256M
suhosin.memory_limit    0   0

Is there a limitation due to apache module, or PHP conf? I know the server only have 4G of RAM, it's just a special script.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

How are you trying to set the memory limit? phpinfo() shows current PHP reserved memory limit, this is what is available due to php.ini having that set as a memory limit

Writing this to Apache .htaccess in your script directory might work, if your server supports setting PHP commands through .htaccess:

php_value memory_limit 2048M

Since it may be possible that .htaccess commands for setting PHP values are turned off. Then you can also try this from PHP code:

ini_set('memory_limit', '2048M');

If this doesn't work and .htaccess also doesn't work, then you need to contact server administrators.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...