Re: PHP memory limit upper bound
On 03/10/14 02:57, Grigor Kolev wrote:
>>> Hi all,
>
>>>
>
>>> I need to set the PHP memory limit to more than 512 MB and found that I
>
>>> can't. Is this caused by the Suhosin patch (my guess), and how to get
>
>>> around it?
>
>>>
>
>>> (I tried to set suhosin.memory_limit to 1024M: no change. Was told that
>
>>> php5-suhosin might be more configurable, but it breaks some package
>
>>> dependencies, and I can't afford this easily.)
You run Sid *and* old php. You lead an interesting life!
>
>
>>Did you try edit /etc/php5/conf.d/suhosin.ini from:-
>
>>;suhosin.memory_limit = 0
>
>>to:-
>
>>suhosin.memory_limit = 1G
>
>
>>(NOTE the suffix used above)
>
>
>>Don't forget to check php.ini and ensure a similar settings for max_post
>
>>and memory_limit
>
>
> No file /etc/php5/conf.d/suhosin.ini exists on a standard Sid php5-common
How did you "patch" php?
What "patch" did you apply?
>
> install at the moment.
Apologies - I should have pointed out that I don't run Sid servers,
mostly Squeeze (which does have php5-suhosin) and a few Wheezy - which
doesn't have php5-suhosin. So my experience may *not* translate :(
scottfer@dom003039:~$ lsb_release -d
Description: Debian GNU/Linux 6.0.10 (squeeze)
scottfer@dom003039:~$ mlocate suhosin
/etc/php5/conf.d/suhosin.ini
/usr/lib/php5/20090626+lfs/suhosin.so
/usr/share/doc/php5-suhosin
/usr/share/doc/php5-suhosin/CREDITS
/usr/share/doc/php5-suhosin/changelog.Debian.gz
/usr/share/doc/php5-suhosin/changelog.gz
/usr/share/doc/php5-suhosin/copyright
/usr/share/doc/php5-suhosin/examples
/usr/share/doc/php5-suhosin/examples/suhosin.ini.gz
/var/lib/dpkg/info/php5-suhosin.conffiles
/var/lib/dpkg/info/php5-suhosin.list
/var/lib/dpkg/info/php5-suhosin.md5sums
/var/lib/dpkg/info/php5-suhosin.postinst
> And no path /etc/php5/conf.d/. There are
>
> /etc/php5/apache2/conf.d/ and /etc/php5/cli/conf.d/, with no file
>
> suhosin.ini in either. (I tried to manually create one with this
>
> setting: no result. Same with modifying php.ini.)
scottfer@dom003039:~$ mlocate suhosin | grep .ini$
/etc/php5/conf.d/suhosin.ini
:/
Try /etc/php5/conf.d/suhosin.ini - it *should* be there, though I'm
confused by this "patch" and it's effects.
NOTES:
* if you only have a web hosting account instead of full access you may
need to modify ~/etc/php.ini or similar. Some web hosting providers will
not let you set memory limits. I "assume" you have a vps at a minimum.
* AFAIK ini set won't work if you have safe mode enabled
* you can't set a memory limit above what is available to the system
>
>
> <?php
>
> ini_set ( 'suhosin.memory_limit', '1G' );
>
> ini_set ( 'memory_limit', '1G' );
>
>
> ini_get ( 'memory_limit' ); // returns '1G' - so far, so good
Unfortunately it will report that even if that amount of memory is not
available.
>
>
> file_put_contents ( $about_520M );
>
> // PHP Fatal error: Allowed memory size of 536870912 bytes exhausted...
What do you get from (as the user running the php process):-
php -i | grep memory_limit
>
>
> Changing the system to pass data in portions would require a nearly
>
> complete rewrite (~70,000 lines of code). Data size never gets over
>
> 1G, so with a 2G memory_limit, which is realistic, the system will work
>
> fine.
>
>
> Thanks again,
>
>
> Grigor
>
>
>>>
>
>>> Debian Sid, amd64, php5-common 5.6.0+dfsg-1+b1. If you need more info,
>
>>> please don't hesitate to ask.
Do you host the server yourself?
How much RAM is on the system?
How much is available? (i.e. free -m)
>
>>>
>
>>> Thanks in advance,
>
>>>
>
>>> Grigor
>
Kind regards
Reply to: