[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: PHP memory limit upper bound




>>>> 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)

 

 

@Scott Ferguson:

 

5.6.0+dfsg-1+b1 is the current php-common version for Sid.

 

I haven't applied any patch to it. What I discuss as a possible problem

origin is the Suhosin patch applied by the package maintainers. (Applying

a patch of mine would solve the problem, but that would be washed away by

the package flow in Sid. Also, it won't solve the problem at potential

software users: I need a solution to describe for these.)

 

Squeeze and Wheezy PHP5 experience might not translate directly into Sid

one, as the package maintainers have made meanwhile some changes (useful

and needed ones, I think). Part of these changes is that /etc/php5/conf.d

doesn't exist anymore - there are already separate

/etc/php5/apache2/conf.d and /etc/php5/cli/conf.d. (Using a suhosin.ini

there doesn't work, as well as posting the suhosin settings in the code

or in any php.ini file.)

 

Maybe I need some counsel on what Suhosin patches the package maintainers

apply, and is there another way to configure it besides fixing directly

the code and recompiling it.

 

From what I have heard, php5-common carries a Suhosin patch that does few

things (limiting RAM is one of them), but might not be configurable. The

full patch, which is configurable, is said to be in php5-suhosin, but that

breaks most other PHP packages, which I can't afford. Is there anyone

around who would know something about this?

 

The 'server' is my home PC. 16G RAM, over 12 of them free and available to

the process.

 

php -i | grep memory_limit returns "memory_limit => -1 => -1".

 

@Jerry Stuckle:

 

I looked through the phpinfo() output, but couldn't notice anything unusual.

 

Thanks again for the help!



Reply to: