Author |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Tue 11 Dec '12 22:14 Post subject: Apache 2.4.3 + PHP 5.4.9 + MySQL 5.5.28 = random crashes |
|
|
Hello,
I've crawled a lot but couldn't find yet a solution for my problems with Apache 2.4.3 + PHP 5.4.9 + MySQL 5.5.28 (x64) combo.
Problems:
- Apache crashes and restarts randomly in x minutes or hours.
In apache errors log:
Quote: | Cannot initialize zend_mm storage [win32]
Parent: child process exited with status 255 -- Restarting. |
In Event Viewer:
Quote: | Faulting application httpd.exe, version 2.4.3.0, time stamp 0x502f70a3, faulting module php5ts.dll, version 5.4.9.0, time stamp 0x50ad37b2, exception code 0xc0000005, fault offset 0x0008139f, process id 0x1d98, application start time 0x01cdd7bb7df21ac6. |
- Sometimes Apache stucks in and no pages is serving (found at 25% and at 99%), browser wait and wait for the server to response... And I have to kill apache process (without restarting the service). Does anyone knows what's the reason for this? Maybe it happens a few times a week. I don't think it's related to memory since I've found it stuck at 99% with about 15MB usage..
I have tried several things found around:
- I've copied libmysql.dll from mysql/lib/ to apache/bin, php, windows/system32
- I've copied libmysqld.dll from mysql/lib/ to apache/bin, php, windows/system32
- Set PHP path to Windows environment
- Tried with VC10, VC9 (x86, x64) runtimes
- Different Apache options
I am using:
- Apache 2.4.3, x86, from apachelounge
- PHP 5.4.9, x86, from official site
- MySQL5.5.28, x64, from official site
- php5apache2_4.dll from apachelounge
PHP Extensions:
- php_gd2.dll
- php_mysql.dll
Apache modules:
- log_rotate_module
- php5_module
- rewrite_module
- deflate_module
- filter_module
Apache tune:
Quote: |
HostnameLookups off
ExtendedStatus Off
KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 500
Timeout 5
ThreadsPerChild 600
MaxConnectionsPerChild 0
AcceptFilter http none
AcceptFilter https none
EnableSendfile Off
EnableMMAP off
|
OS:
- Windows Server 2008 Standard SP1 (64-bit)
Hardware:
- Intel Xeon E5420
- 8GB RAM
Site has many hits per day. Impresions 150.000-250.000+ w/o static content included...
This random thing drives me nuts! And most annoying is that I cannot/don't know how to reproduce it..
Does anyone know what's wrong?
Thank you! |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Wed 12 Dec '12 15:22 Post subject: |
|
|
Almost sure this is a PHP issue:
Cannot initialize zend_mm storage [win32]
Parent: child process exited with status 255 -- Restarting
You can try a higher memory_limit in PHP.ini.
Think about to use mod_fcgid, then php errors do not push Apache down. It just starts an other PHP fcgid process and kills the faulty one. |
|
Back to top |
|
Smitty
Joined: 03 Jan 2008 Posts: 197
|
Posted: Wed 12 Dec '12 18:07 Post subject: |
|
|
We had this problem on our large Moodle installation for months last year. Random "Parent: child process exited with status 255 -- Restarting" errors. I tried all of the things you've tried. The solution was to switch to mod_fcgid. Once we switched we are able to handle heavy traffic without any crashes.
I suspect it is some bug in the thread-safe version of PHP when using it as an Apache module. |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Thu 13 Dec '12 18:25 Post subject: |
|
|
Thank you guys for the replies.
I've already incresed memory in PHP to 128MB. A final page consumes less than 1MB memory (tested with memory_get_peak_usage(), memory_get_peak_usage(true), memory_get_usage()).
What's the most annoying thing is that httpd.exe get stuck randomly at 25% or 99% and the whole site is down till Apache is restarted or httpd.exe killed..
So I don't have another solution but just to switch to mod_fcgid?
Thank you |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Sat 15 Dec '12 13:55 Post subject: |
|
|
New error spotted in Event Viewer:
Quote: | Faulting application httpd.exe, version 2.4.3.0, time stamp 0x502f70a3, faulting module ntdll.dll, version 6.0.6001.18538, time stamp 0x4cb733e1, exception code 0xc0000005, fault offset 0x000530b7, process id 0x1e70, application start time 0x01cdd9e65b9548a0. |
|
|
Back to top |
|
Smitty
Joined: 03 Jan 2008 Posts: 197
|
Posted: Sat 15 Dec '12 16:53 Post subject: |
|
|
I saw that error too when trying to run the thread safe PHP as an Apache module.
Unfortunately, I think the solution is to switch to mod_fcgid. The sad truth is that I don't think enough administrators are running PHP on Windows for it to be tested very thoroughly. Especially on high-traffic websites. |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Sat 15 Dec '12 17:02 Post subject: |
|
|
I see Smitty. You're right about PHP + Windows servers..
Well, I guess in the end I have to move to mod_fcgid. Thank you for your input! |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Fri 21 Dec '12 23:25 Post subject: |
|
|
Another random error that I got from time to time:
Fatal error: Out of memory (allocated xx) (tried to allocate xx bytes).
The problem was solved by restaring apache... Don't think that has to do with PHP memory_limit as I've set it to 1500M! Nor the system RAM, were plenty of free gigs. And the page that triggered that error consume less than 1MB RAM!
This and the apaches stucks at 99% & 25% motivated me to switch to mod_fcgid. I've just switched a few moments ago. Hope those problems gone away..
Another problem what I'm trying to solve is the interruption of downloads that are served directly by apache and not php. It happens random, don't know why.. Any clues?
I'm using the same custom settings as in the first post with the following additions:
KeepAliveTimeout 45
MaxKeepAliveRequests 1000
[fgci related settings] |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Sat 22 Dec '12 16:00 Post subject: |
|
|
Hey guys,
What approach it's better:
Quote: | FcgidMaxProcesses 50
FcgidMaxRequestsPerProcess 1000
|
or
Quote: | FcgidMaxProcesses 50
FcgidMaxRequestsPerProcess 0
ProcessLifeTime 0
|
I'm afraid that If I go with second option I will get "Out of memory" PHP errors.
Right now I'm using the first option and sometimes the first request to the site seems a bit longer, with about 0.5-2 seconds more. I suspect it's because mod_fcgid kills processes because of FcgidMaxRequestsPerProcess has reached to it's limite of 1000 requests. Is it true?
And I've seen no more than 5-7 php-cgi.exe opened processes in taskmgr.. Even if I have more than 50 active connections.
In apache error.log lots of:
Quote: | [fcgid:warn] [pid 3800:tid 236] mod_fcgid: process 4308 graceful kill fail, sending SIGKILL
|
My current Fcgid settings:
Quote: | FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 50
FcgidIOTimeout 64
FcgidIdleTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestLen 157286400
FcgidOutputBufferSize 131072 |
|
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Wed 02 Jan '13 18:21 Post subject: |
|
|
Happy new year!
I've solved my main problem by switching to fcgi and tuning it. Thank you guys!
Here's my config in case of someone is searching for a stable WAMP solution (sources: apachelounge, google)
Quote: | #fcgid
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 5000000000
FcgidMaxRequestsPerProcess 0
FcgidMaxProcesses 100
FcgidProcessLifeTime 0
FcgidTimeScore 3
FcgidZombieScanInterval 20
FcgidIOTimeout 250
FcgidIdleTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestLen 157286400
FcgidOutputBufferSize 131072
#apache
HostnameLookups off
ExtendedStatus On
KeepAlive On
KeepAliveTimeout 45
MaxKeepAliveRequests 1000
Timeout 5
ThreadsPerChild 700
MaxConnectionsPerChild 0
AcceptFilter http none
AcceptFilter https none
EnableSendfile Off
EnableMMAP off
|
I'm happy with the settings. All loads nice and fast.
"451 requests currently being processed"
I highly recommend WinCache. Such a great module for storing different data in RAM (eg: sessions, user data, opcode)!
Now If I could find a fix for the (random) interruption of downloads (small files, less than 3-5MB).. This must be something in Apache and/or Windows. Any idea? |
|
Back to top |
|
japi
Joined: 05 Jan 2013 Posts: 6 Location: Frankfurt
|
Posted: Sun 06 Jan '13 2:25 Post subject: |
|
|
Hi everyone!
@UnLucky: Thanks for sharing your config, I'm currently setting up php via fcgi on my server too (I have been using the apache.org binaries + mod_php for the last 5 years... It's time for a change ^^).
Do the interruptions only occur on downloads through php or on static files too?
Why did you disable EnableSendfile and EnableMMAP? I have not experienced problems leaving them enabled on Windows Server 2008 R2. I have not benchmarked it, but it felt like the file downloads were a little slower if i disabled them.
Increasing the Timeout directive (maybe to 30) could also help (your current setting aborts the download if no ACK arrives for 5 seconds. Some W-LAN Users with a bad signal could easily run into that I think).
You could also try mod_xsendfile if your php application supports it, maybe that helps
Best Regards,
JP |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Mon 07 Jan '13 16:52 Post subject: |
|
|
Hi japi,
No problem!
Yes, mod_fcgi is a way better solution than mod_php! More stable and no apache stucks, at least till now. Been using days with no problem.. With mod_php I got lots of crashes (ntdll.dll, php5ts.dll). Or apache stucking at 99% and 25% resulting no page load until I killed the process or restart the service.
Regarding the interruption of downloads, you are right. I thought that Timeout directive is only for client first connection (since I use KeepAlive too).. Thank you for bringing this! I've increased the timeout and so far so good. Downloads are static.
I've disabled EnableMMAP/EnableSendfile because I've experienced slow-response problems if I recall correctly. That's true that when I was using mod_php. Haven't tried to play with them after switching to mod_fcgid since all works ok.
Thanks about mod_xsendfile tip. Maybe I will try that someday.
Edit: I've tried with EnableSendfile On and the download seems to be slower than with it Off.. |
|
Back to top |
|
der_Ronny
Joined: 13 Apr 2012 Posts: 6 Location: Austria
|
Posted: Wed 23 Jan '13 16:44 Post subject: same problem |
|
|
Hi,
i'm running Apache 2.4.3 and PHP 5.4.8 (both w32 version) on Hostsystem with Windows 7 ultimate, x64.
httpd.exe crashes randomly with the error:
Faulting application httpd.exe, version 2.4.3.0, time stamp 0x502f70a3, faulting module php5ts.dll, version 5.4.9.0, time sta....
Is the fcgi-solution the only way to solve this problem at this time?
I've never used fcgi....
i ever used the php_mod.....no knowledge how to implement the fcgi solution. :/
greetings, ronny |
|
Back to top |
|
der_Ronny
Joined: 13 Apr 2012 Posts: 6 Location: Austria
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 26 Jan '13 1:08 Post subject: Re: PHP as CGI |
|
|
der_Ronny wrote: | Is there a documentation how to install PHP 5.x as a FCGI (like your description for troubleshooting in this article) on Apache 2.x Webserver?
|
An example you can find here http://www.apachelounge.com/viewtopic.php?t=4043
Yes you can use that documentation
Depence where you downloaded your apache. |
|
Back to top |
|
der_Ronny
Joined: 13 Apr 2012 Posts: 6 Location: Austria
|
Posted: Thu 31 Jan '13 10:00 Post subject: same crashes with php 5.4.11 |
|
|
okay, now I tried to solve the crashes with apache 2.4.3 and the newest php version (5.4.11) -> still the same problem --> httpd.exe crashes -> fault module: php5ts.dll
I also tried to use php as fast cgi module.
It seems that there are no crashes, but I have a customer on my webserver with a Joomla! 1.5 written homepage...
When I use the fcgi-implementation of php, the website could not be loaded correctly. Other PHP-Pages seems to work.
Do you know any dependences of Joomla! 1.5 and php-fcgi-implementations?
regards,
ronny |
|
Back to top |
|
der_Ronny
Joined: 13 Apr 2012 Posts: 6 Location: Austria
|
Posted: Thu 31 Jan '13 16:32 Post subject: interesting |
|
|
...it looks like the problem doesn't result from the PHP Version...I think it's a problem with the apache release...
anyone get this errors with an earlier version of apache (< 2.4.3)?? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 31 Jan '13 21:38 Post subject: |
|
|
If php5ts.dll is crashing still, that means you are still loading the php5apache2_x.dll. It is this that has the problem. When using mod_fcgid, you do not need to load that module. |
|
Back to top |
|
UnLucky
Joined: 11 Dec 2012 Posts: 11
|
Posted: Fri 01 Feb '13 22:18 Post subject: |
|
|
der_Ronny,
start with this:
Code: |
LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PHPRC "C:\\server\\php"
FcgidInitialEnv PATH "C:\\server\\php;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\SHAREMOBILE\\TEMP"
FcgidInitialEnv TMP "C:\\SHAREMOBILE\\TEMP"
FcgidInitialEnv windir "C:\\WINDOWS"
|
and use the rest of my mod_fcgi config posted in this topic. I'm using this for a while and the whole thing it's stable.
(you need to replace C:\\server\\php with the path of php non-safe thread version - that's the fcgi_mod)
Make sure you comment the line that loads the php5 apache module. |
|
Back to top |
|
der_Ronny
Joined: 13 Apr 2012 Posts: 6 Location: Austria
|
Posted: Mon 04 Feb '13 14:05 Post subject: fcgi |
|
|
Hi,
okay I've implemented the fcgi solution...
summary of my config:
httpd.conf
Code: |
LoadModule fcgid_module modules/mod_fcgid.so
AddType application/x-httpd-php .php
<IfModule fcgid_module>
FcgidInitialEnv PHPRC "C:\\Programme\\php"
FcgidInitialEnv PATH "C:\\Programme\\php;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv windir "C:\\WINDOWS"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 5000000000
FcgidMaxRequestsPerProcess 0
FcgidMaxProcesses 100
FcgidProcessLifeTime 0
FcgidTimeScore 3
FcgidZombieScanInterval 20
FcgidIOTimeout 250
FcgidIdleTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestLen 157286400
FcgidOutputBufferSize 131072
HostnameLookups off
ExtendedStatus On
KeepAlive On
KeepAliveTimeout 45
MaxKeepAliveRequests 1000
Timeout 5
ThreadsPerChild 700
MaxConnectionsPerChild 0
AcceptFilter http none
AcceptFilter https none
EnableSendfile Off
EnableMMAP off
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "c:\Programme\php\php-cgi.exe" .php
</Files>
</IfModule>
|
Logfile of my Apache-errorlog:
Code: |
[Mon Feb 04 12:49:25.005600 2013] [mpm_winnt:notice] [pid 3616:tid 468] AH00455: Apache/2.4.3 (Win32) mod_fcgid/2.3.7 configured -- resuming normal operations
[Mon Feb 04 12:49:25.007600 2013] [mpm_winnt:notice] [pid 3616:tid 468] AH00456: Server built: Aug 20 2012 14:21:37
[Mon Feb 04 12:49:25.007600 2013] [core:notice] [pid 3616:tid 468] AH00094: Command line: 'C:\\Program Files\\Apache Webserver\\bin\\httpd.exe -d C:/Program Files/Apache Webserver'
[Mon Feb 04 12:49:25.009600 2013] [mpm_winnt:notice] [pid 3616:tid 468] AH00418: Parent: Created child process 4588
[Mon Feb 04 12:49:26.206600 2013] [mpm_winnt:notice] [pid 4588:tid 368] AH00354: Child: Starting 700 worker threads.
[Mon Feb 04 12:50:36.773600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 3748 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:51:36.777600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 1612 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:52:59.014600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 3412 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:53:05.261600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 4072 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:53:05.265600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 3384 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:53:11.268600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 3188 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:55:18.739600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 3656 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:55:18.744600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 4368 graceful kill fail, sending SIGKILL
[Mon Feb 04 12:55:18.809600 2013] [fcgid:warn] [pid 4588:tid 348] mod_fcgid: process 2700 graceful kill fail, sending SIGKILL
|
Are this fcgid:warnings ok?
best regards, ronny |
|
Back to top |
|