Hi to all !
well another strange problem concering Apache performance and EasyPHP:
Having Moodle 1.5.4 on a double Opteron (2-double XeoN) with 4G RAM...
Our system started to work fine. But suddenly one day I couldn't connect to Moodle PHP pages. After entering the URL, the page was blank and the IE was trying to connect. I'm checking the server but was UP and running, easyPHP was UP and eveything were OK...
Well I opened Task Manager (Win 2003 Server) and observed that Apache Service instance had over 256M of RAM ! A snapshot of the Task Manager can be seen below (Apache instance has already over 140M).
Every time I was refreshing the central Moodle page, the Apache memory in Task Manager was increasing by 15-20M !! When it reached 264M the server was NOT serving any request and the system got too slow !!
A new observation was that when restarting EasyPHP, Moodle was fine..but when Apache instance reached approx. 263M, Apache was not serving any request... restarting again fixed the problem but for a short time...
Any ideas ? I'm scanning http.conf and php.ini but cannot find something...
By "IE" do you mean the browser? Or is this problem connected to your other thread here http://moodle.org/mod/forum/discuss.php?d=85609
We attempted to use Windows 2003, Apache 2.x.x and several versions of PHP 5.x.x and ran into this problem as well.
If you google Apache 2 and PHP 5 with the phrase "memory leak" you will find hundreds of sites all over the world who have exactly the problem you describe. This goes back many years to 2003. We gave up on this setup after trying about 10 combinations of Apache 2.x and PHP 5.x and always seeing the leak. What happens in that the Apache processes with PHP apparenty generate child processes that do NOT release the RAM after the process is done. Restarting your Apache server will also free the memory, and even though you can automate this it is a very ugly solution. What you want is a set of PHP and Apache that does not "leak"
There might be some good news though, apparently from what i can tell in some Moodle forums, there are "islands of stability" with certain combinations Windows 2003, Apache 2.x , and PHP 5.2.1 (PHP 5.2.1 is often strongly recommended) and so it appears some sets do NOT produce the leak. People who find a "stable combo" recommend staying with it and upgrading to newer PHP and/or Apache ONLY after testing it on a NON-production server to see that the mem leak doesn't reappear. I am sorry i do not have the link to the successful combinations with me, ( search the Windows Moodle Forums you should be able to find the threads).
Disclaimer: I read about these "successful" PHP/Apache/2003 combinations after we gave up on Windows so I did not test it myself , but I respect the people who use claim to have found them. YMMV Another options that some bigger sites do is to use IIS and FastCGI instead of Apache. again... YMMV
It's just that Apache ships with a default configuration that is OK with regards to memory management for a non-PHP Apache. Once you add PHP (or Ruby/Python/Perl), the doco should explain that you have to tune settings so that it doesn't take all the memory in the world.
Not many people understand Apache's memory model -- which is a bit weird as memory allocation models go, but makes Apache fast, fast, FAST. I am fortunate enough to have worked a lot with mod_perl and a bit of apache internals, and learned lots about it.
If you google these forums for maxclients, you will find decent explanations of the memory-math you have to do, and how to use maxclients to rein Apache in...
Thanks for your thoughtful follow-up on this issue... as the PHP link in your email shows this is very real, and maddening problem for folks needing Moodle/PHP/Apache on Windows 2003 server. Also, my team DID try several strategies for Apache/PHP tuning (Max threads, clients, etc.) nothing helped.
During our Windows-Moodle testing (last summer) we used many versions of Apache 2.0.5x and at least four versions of PHP 5.2.x We tried PHP 5.2.4 because of the talk of the Mem-bug fix and it didn't help our Apaches 2.0.xx). Sadly, the one PHP version we didn't try (PHP v 5.2.1) is one which several people here suggested might work (with certain Apache 2.x versions).
Somewhere in these Moodle forums I know folks I respect did suggest a couple of successful W2K3, Apache 2.x and PHP 5.x combinations with NO mem issues for them... but I can't find the post again. (probably tacked on badly named thread)
It would be huge benefit to all the people here if these settings could be found and posted as a thread with proper title.