PHP memory limit - 8MB ?
PHP memory limit - 8MB ?
A search showed that a number of people have asked this question -- but I have not seen any answers. I hope it's OK if I post the question again.
My local development server is EasyPHP 1.8.01, a WAMP system (on Win2K SP4 or WinXP SP2 - both of which see this problem). [The production server is 1and1.com's LAMP system. I do this development from Windows because I'm setting up a site for multiple editors (the same reason I came to CMSMS), and want to be sure that I see any problems they might see.] When I installed CMSMS to my local server, the "Install System" page ran its tests and warned of two problems:
- PHP memory limit = 8M [recommended: 16M]
- max upload file size = 2M [recommended: 10M]
So I edited php.ini to the recommended values and tried again -- but the "Install System" report still had a problem: Weirdly, it recognized only one of the two changes:
- PHP memory limit = 8M [recommended: 16M]
- max upload file size = 10M [recommended: 10M]
Then I found that it did not matter what value I used to initialize PHP memory limit: I tried 16M, 32M, 4M ... everything was read as "8M". So I suspected a problem with the way CMSMS tests this value, and searched for info on www.cmsmadesimple.org, and then on forum.cmsmadesimple.org ... and then I saw the unanswered questions on this issue. Still, let me try again: Anyone know what is going on here?
Also, what are the likely consequences? 8MB seems way more than enough space for any script I might write. Do they really get larger?
My local development server is EasyPHP 1.8.01, a WAMP system (on Win2K SP4 or WinXP SP2 - both of which see this problem). [The production server is 1and1.com's LAMP system. I do this development from Windows because I'm setting up a site for multiple editors (the same reason I came to CMSMS), and want to be sure that I see any problems they might see.] When I installed CMSMS to my local server, the "Install System" page ran its tests and warned of two problems:
- PHP memory limit = 8M [recommended: 16M]
- max upload file size = 2M [recommended: 10M]
So I edited php.ini to the recommended values and tried again -- but the "Install System" report still had a problem: Weirdly, it recognized only one of the two changes:
- PHP memory limit = 8M [recommended: 16M]
- max upload file size = 10M [recommended: 10M]
Then I found that it did not matter what value I used to initialize PHP memory limit: I tried 16M, 32M, 4M ... everything was read as "8M". So I suspected a problem with the way CMSMS tests this value, and searched for info on www.cmsmadesimple.org, and then on forum.cmsmadesimple.org ... and then I saw the unanswered questions on this issue. Still, let me try again: Anyone know what is going on here?
Also, what are the likely consequences? 8MB seems way more than enough space for any script I might write. Do they really get larger?
Re: PHP memory limit - 8MB ?
Hello,
You did restart apache after making changes to php.ini?
If so PHP may be compiled without memory_limit support.
When PHP runs out of memory (or execution_time) it can cause serious trouble because the execution of the script it is running will be stopped. This could cause "white pages" (no content), error messages and even data corruption (when it happens in the middle of deleting/moving a lot of pages for example).
8M is reached very fast on current PHP versions, especially when UTF-8 is used (it is not a limit on the script filesize, but the memory needed/used to run the script).
Regards,
D
You did restart apache after making changes to php.ini?
If so PHP may be compiled without memory_limit support.
When PHP runs out of memory (or execution_time) it can cause serious trouble because the execution of the script it is running will be stopped. This could cause "white pages" (no content), error messages and even data corruption (when it happens in the middle of deleting/moving a lot of pages for example).
8M is reached very fast on current PHP versions, especially when UTF-8 is used (it is not a limit on the script filesize, but the memory needed/used to run the script).
Regards,
D
Re: PHP memory limit - 8MB ?
uh-huh... so if I switch to another encoding (for instance an iso norm), the memory usage will be lower?
Re: PHP memory limit - 8MB ?
I don't think switching at that level will make a lot of difference.
Memory usage depends on a lot of things.
In my experience the 8M limit is reached sooner on a server with UTF-8 support than on one where the kernel and all software are compiled without.
Regards,
D
Memory usage depends on a lot of things.
In my experience the 8M limit is reached sooner on a server with UTF-8 support than on one where the kernel and all software are compiled without.
Regards,
D
Last edited by Anonymous on Thu Mar 15, 2007 9:06 pm, edited 1 time in total.
Re: PHP memory limit - 8MB ?
Yes. As I said, it was weird that one of the two changes (max upload file size) was recognized and one change (memory limit) was not. Also as I said, others have reported the same problem (though I have not found answers for it posted).Dee wrote: You did restart apache after making changes to php.ini?
Yes? - then why include the parameter in php.ini? IAC, at least it is a possible answer, so I will look into the possibility.If so PHP may be compiled without memory_limit support.
Yes, I understood we are talking about working memory, not filesize; sorry if my clumsy question seemed to imply otherwise. I'm still surprised at the size, which begs a further question: If 8M is so easy to reach, how do we determine that 16M is safe?When PHP runs out of memory (or execution_time) it can cause serious trouble because the execution of the script it is running will be stopped. This could cause "white pages" (no content), error messages and even data corruption ... 8M is reached very fast on current PHP versions, especially when UTF-8 is used (it is not a limit on the script filesize, but the memory needed/used to run the script).
Thanks for your reply,
John
Re: PHP memory limit - 8MB ?
Yeskaufmann wrote:Yes? - then why include the parameter in php.ini? IAC, at least it is a possible answer, so I will look into the possibility.If so PHP may be compiled without memory_limit support.

16M is probably not what you could call "safe" - better set it to a decent value like 128M (the default in current PHP versions)kaufmann wrote: If 8M is so easy to reach, how do we determine that 16M is safe?
Regards,
D
Re: PHP memory limit - 8MB ?
After some surfing & searching it seems this has come up before.
Windows PHP builds have support for memory_limit since 5.1.3 (I'm not sure if current PHP4 versions have support for it).
See this bug and this changelog.
Regards,
D
Windows PHP builds have support for memory_limit since 5.1.3 (I'm not sure if current PHP4 versions have support for it).
See this bug and this changelog.
Regards,
D
Re: PHP memory limit - 8MB ?
I usually add the following line to scripts that have memory allocation errors...
Works for me - my host is on a linux server and has the default set to 8M.
Nullig
Code: Select all
ini_set("memory_limit", "16M");
Nullig
Re: PHP memory limit - 8MB ?
I guess "safe" was not the right word for 16M -- install.php calls it "recommended", and it sounds like your recommendation is much higher. I don't do any server administration, so I'm surprised by the memory requirements and totally clueless about this question: When 128M is the limit for a single process, does the server provide some multiple of that for each concurrent user?Dee wrote:16M is probably not what you could call "safe" - better set it to a decent value like 128M (the default in current PHP versions)If 8M is so easy to reach, how do we determine that 16M is safe?
Regards,
- John
Re: PHP memory limit - 8MB ?
Thanks! I'm sorry that did not turn up in my earlier search, but it confirms your initial reply to my question, that PHP might be compiled without memory_limit support. As I have since learned, that was the case.Dee wrote: After some surfing & searching it seems this has come up before.
Nice catch! As it said in the bug report, "Windows builds are made without enabling memory limit since the dawn of time." - a situation that only changed with the bug fix in PHP 5.1.3.Windows PHP builds have support for memory_limit since 5.1.3 (I'm not sure if current PHP4 versions have support for it).
See this bug and this changelog.
I hope others who might have this problem with Windows servers find this thread.
Regards,
John
Re: PHP memory limit - 8MB ?
Thanks for the suggestion, but I tried adding that to config.php and include.php, with no luck -- for the simple reason, as Dee said, that in this case [for my local development server, under Windows] PHP was compiled without memory_limit support. Still I will keep this in mind for my web host, in case needed. I appreciate your mention of it.Nullig wrote: I usually add the following line to scripts that have memory allocation errors...Works for me - my host is on a linux server and has the default set to 8M.Code: Select all
ini_set("memory_limit", "16M");
Regards,
John
Re: PHP memory limit - 8MB ?
Hello, it's me again...
I'd like to know whether it is possible to find out how much memory the scripts use on the WAMP local development system. I would like to know the requirements in advance.
I'd like to know whether it is possible to find out how much memory the scripts use on the WAMP local development system. I would like to know the requirements in advance.