I am trying to track down the cause of my Apache PHP crashes. I am hoping there is some kind of setting, tool or something to help track down what code, configuration or what the issue is that is causing these php crashes.
In my Windows event log I have (shows apache crashing, but caused by php):
Faulting application httpd.exe, version 2.2.21.0, time stamp 0x4e6b3136, faulting module php5ts.dll, version 5.3.8.0, time stamp 0x4e537a04, exception code 0xc0000005, fault offset 0x0000c7d7, process id 0xbf4, application start time 0x01cd45afc42f0b7d.
The application utilizes Apache, PHP and MySQL on a Windows Server 2008 machine (xampp).
This is the crash in my Apache log:
[Fri Jun 08 15:56:34 2012] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Fri Jun 08 15:56:35 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 08 15:56:35 2012] [notice] Digest: done
[Fri Jun 08 15:56:35 2012] [notice] Apache/2.2.21 (Win32) PHP/5.3.8 configured -- resuming normal operations
[Fri Jun 08 15:56:35 2012] [notice] Server built: Sep 10 2011 11:34:11
[Fri Jun 08 15:56:35 2012] [notice] Parent: Created child process 1220
[Fri Jun 08 15:56:35 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 08 15:56:35 2012] [notice] Digest: done
[Fri Jun 08 15:56:35 2012] [notice] Child 1220: Child process is running
[Fri Jun 08 15:56:35 2012] [notice] Child 1220: Acquired the start mutex.
[Fri Jun 08 15:56:35 2012] [notice] Child 1220: Starting 150 worker threads.
[Fri Jun 08 15:56:35 2012] [notice] Child 1220: Starting thread to listen on port 80.
[Fri Jun 08 15:56:35 2012] [notice] Child 1220: Starting thread to listen on port 80.
[Fri Jun 08 15:57:37 2012] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Fri Jun 08 15:57:37 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 08 15:57:37 2012] [notice] Digest: done
[Fri Jun 08 15:57:37 2012] [notice] Apache/2.2.21 (Win32) PHP/5.3.8 configured -- resuming normal operations
[Fri Jun 08 15:57:37 2012] [notice] Server built: Sep 10 2011 11:34:11
[Fri Jun 08 15:57:37 2012] [notice] Parent: Created child process 3932
[Fri Jun 08 15:57:38 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Jun 08 15:57:38 2012] [notice] Digest: done
[Fri Jun 08 15:57:38 2012] [notice] Child 3932: Child process is running
[Fri Jun 08 15:57:38 2012] [notice] Child 3932: Acquired the start mutex.
[Fri Jun 08 15:57:38 2012] [notice] Child 3932: Starting 150 worker threads.
[Fri Jun 08 15:57:38 2012] [notice] Child 3932: Starting thread to listen on port 80.
[Fri Jun 08 15:57:38 2012] [notice] Child 3932: Starting thread to listen on port 80.
Any thoughts on what I should try, or tools/techniques to trace back to what code, etc. might be causing this?
Since XAMPP's Apache (for Windows) is built with winn_nt MPM (multi-thread) + Thread-Safe PHP, it may be that you are hitting a problem inherent to the supposedly Thread-Safe versions of PHP (see this very good post for more information). This could explain why you never encounter the error when running in a single-user mode.
Please let us know if Uku Loskit's suggestion did any good. If not, I would recommend switching to a Prefork + Non-Thread-Safe PHP setup in such a multi-user environment.
Because MPM must be chosen at compile-time, you would need to either:
compile Apache yourself (technically feasible, but quite a pain in the neck on Windows, as far as I remember)
find a distribution other than XAMPP, which is built with prefork (I do not know any)
Perhaps you'd better try to run PHP with FastCGI (this extra layer basically isolates server threads by starting a separate PHP process for each thread, and much more). This should allow you to verify easily enough my initial assumption.
Just a side note: I do not see the point in installing Apache on a Windows Server. You may want to consider either using IIS, optionally with FastGCI (see instructions here), or (better) switch to a Linux-based stack.
Related
Okay, first of all I understand and ... permit ... you all to laugh: I have a local server running php 4,4 / apache / mysql - installed with xampp distribution. Just simply haven't got the time to upgrade all the code that has been serving me for years and is still serving me well :-)
To the issue - I can't make a try/catch ... beeeecause of the old php version. I have a script that parses a dir and to a lot of things to all the files ... and after several 100 thousand files over the years without problems ... I now find that the server shuts down / browser looses connection probably because of a single file ... but for my life I can't figure out which. So thought maybe I could figure it out through the error log. But ... I didn't learn much - and thought I might ask some wise guys here if there is anything I can learn from the following from my error log - regarding maybe what function/file or whatever it is that causes the breaking...:
[Tue Feb 14 20:47:26 2017] [crit] (22)Invalid argument: unable to replace stderr with error_log
[Tue Feb 14 20:47:26 2017] [crit] (2)No such file or directory: unable to replace stderr with /dev/null
[Tue Feb 14 20:47:26 2017] [notice] Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.8 PHP/4.4.0 mod_autoindex_color configured -- resuming normal operations
[Tue Feb 14 20:47:26 2017] [notice] Server built: Jul 28 2005 18:10:37
[Tue Feb 14 20:47:26 2017] [notice] Parent: Created child process 5384
[Tue Feb 14 20:47:27 2017] [notice] Child 5384: Child process is running
[Tue Feb 14 20:47:27 2017] [notice] Child 5384: Acquired the start mutex.
[Tue Feb 14 20:47:27 2017] [notice] Child 5384: Starting 250 worker threads.
[Tue Feb 14 20:47:36 2017] [notice] Parent: child process exited with status 3221225725 -- Restarting.
[Tue Feb 14 20:47:36 2017] [crit] (22)Invalid argument: unable to replace stderr with error_log
[Tue Feb 14 20:47:36 2017] [crit] (2)No such file or directory: unable to replace stderr with /dev/null
[Tue Feb 14 20:47:36 2017] [notice] Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.8 PHP/4.4.0 mod_autoindex_color configured -- resuming normal operations
[Tue Feb 14 20:47:36 2017] [notice] Server built: Jul 28 2005 18:10:37
[Tue Feb 14 20:47:36 2017] [notice] Parent: Created child process 3136
[Tue Feb 14 20:47:36 2017] [notice] Child 3136: Child process is running
[Tue Feb 14 20:47:36 2017] [notice] Child 3136: Acquired the start mutex.
[Tue Feb 14 20:47:36 2017] [notice] Child 3136: Starting 250 worker threads.
Got it ... filesize() was failing (silent aparently) for some file(s). Ran it w/o this function and it worked. Case closed...
Edit: strange though ... filesize() suddenly fails on all files. And they are local. Subdir to the htdocs folder ... and the top level folder to this structure is set to all my users to have full control of this folder and all subfolders... weird...
I'm here to ask about a strange behaviour of Apache with accents:
this rule works just fine
RewriteRule ^([èéìòùa-zA-Z0-9_\-\s]*)$ index.php?route=$1 [L]
but if i dare to add an 'à'
RewriteRule ^([àèéìòùa-zA-Z0-9_\-\s]*)$ index.php?route=$1 [L]
Apache loses his mind (Yes, I can hear you reading this with the Joker voice)
Can anyone explain this to me?
UPDATE: Error log
[Wed Nov 12 12:49:43 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Nov 12 12:49:43 2014] [notice] Apache/2.2.21 (Win64) mod_ssl/2.2.21 OpenSSL/1.0.0g PHP/5.3.10 configured -- resuming normal operations
[Wed Nov 12 12:49:43 2014] [notice] Server built: Sep 24 2011 19:57:51
[Wed Nov 12 12:49:43 2014] [notice] Parent: Created child process 3304
[Wed Nov 12 12:49:43 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Nov 12 12:49:44 2014] [notice] Child 3304: Child process is running
[Wed Nov 12 12:49:44 2014] [notice] Child 3304: Acquired the start mutex.
[Wed Nov 12 12:49:44 2014] [notice] Child 3304: Starting 64 worker threads.
[Wed Nov 12 12:49:44 2014] [notice] Child 3304: Starting thread to listen on port 80.
[Wed Nov 12 12:49:44 2014] [notice] Child 3304: Starting thread to listen on port 80.
I was following a tutorial to install APC on my centos vps, and then I ran into a trouble, so found some help here, now my PHP isn't working on apache.
Only the very root index.php works, no other root pages, none in sub directories. If I access the php directly, it forces a download of the file.
This is odd because php has always worked on the server for over a year. When I check error_log, I see this.
[Thu Feb 27 05:56:35 2014] [notice] caught SIGTERM, shutting down
[Thu Feb 27 05:56:35 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Feb 27 05:56:35 2014] [notice] Digest: generating secret for digest authentication ...
[Thu Feb 27 05:56:35 2014] [notice] Digest: done
[Thu Feb 27 05:56:35 2014] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
Anyone have any ideas as to why this is happening?
That's actually a completely normal log
[Thu Feb 27 05:56:35 2014] [notice] caught SIGTERM, shutting down
SIGTERM is sent to daemons being shutdown/restarted
[Thu Feb 27 05:56:35 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
The server is starting, suExec is enabled
[Thu Feb 27 05:56:35 2014] [notice] Digest: generating secret for digest authentication ...
[Thu Feb 27 05:56:35 2014] [notice] Digest: done
Digest authentication is initialized
[Thu Feb 27 05:56:35 2014] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
Apache is ready.
You should use the most paranoid logging settings you can for PHP, it hasn't yet told you what is wrong ;)
My following setup is Xampp 1.7.7 and here is the info for everything in that package:
- Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
I'm running the server on Windows XP SP3 32 bit OS, 4 gigs of ram, Quad Core.
The issue I'm having in my apache error log file is:
[Tue Apr 24 15:55:55 2012] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Tue Apr 24 15:55:57 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 24 15:55:57 2012] [notice] Digest: done
[Tue Apr 24 15:55:59 2012] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Apr 24 15:55:59 2012] [notice] Server built: Sep 10 2011 11:34:11
[Tue Apr 24 15:55:59 2012] [notice] Parent: Created child process 776
[Tue Apr 24 15:56:00 2012] [notice] Disabled use of AcceptEx() WinSock2 API
[Tue Apr 24 15:56:01 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 24 15:56:01 2012] [notice] Digest: done
[Tue Apr 24 15:56:02 2012] [notice] Child 776: Child process is running
[Tue Apr 24 15:56:02 2012] [notice] Child 776: Acquired the start mutex.
[Tue Apr 24 15:56:02 2012] [notice] Child 776: Starting 350 worker threads.
[Tue Apr 24 15:56:02 2012] [notice] Child 776: Listening on port 443.
[Tue Apr 24 15:56:02 2012] [notice] Child 776: Listening on port 80.
This seems to occur sporadically throughout the day and I even tried using Win32DisableEx, EnableIMAP Off and EnableSendFile Off in the apache conf file. I also tried copying the libmysql.dll file to the system32 and apache/bin folders with no avail.
If anyone knows other reasons this error for the child process exiting and causing apache to crash, info would be greatly appreciated. If any additional log files are needed please let me know.
Tks,
Shane.
The error code 3221225477 is 0xC0000005 in hex, which on Windows is:
#define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005L)
Access violation is Windows' version of "segmentation fault", which simply said means that the program tried to access a memory which is not allocated. This can happen for a lot of different reasons, but mostly (if not always) is a bug in the program.
Now, my guess for your situation, is that there is either a bug in PHP or in one of PHP's extensions or in Perl or some Perl application. Apache itself is usually very stable, but if you use some unusual extension, it might be the cause, too.
I would suggest updating all your configuration to latest versions. If you want to find the source of the problem for sure, run Apache inside a debugger, like Visual Studio or OllyDbg. When the exception (access violation) happens, it will stop execution (instead of restarting) and you'll see in which module it is.
Also take a look in the access log, if there is a suspicious request with the same timestamp as the error. But it may happen that the crash happens before the request is saved in the logfile.
http://localhost/joomla/administrator/ The web browser returns an error that the page does not exist after I complete the installation and deleted the folder.
I have to use apache2. I am also using the latest version of apache, mysql. Im using php 5.2.13 VC6 x86 Thread Safe.
I used a combo of two tutorials:
Tutorial 1
Tutorial 2
When I chose mysql as the database it would give me the error right away but if I chose mysqli then I would be able to complete the installation then when I selected either client or administrator then I would get the browser error.
The only difference between the two tutorials is that I used PHPIniDir instead of copying and pasting it to apache.
httpd.conf
LoadModule php5_module "c:/datafiles/php/php5apache2_2.dll"
AddType application/x-httpd-php .php .phtml .inc .php3
AddType application/x-httpd-php-source .phps
PHPIniDir "c:/datafiles/php"
I also changed ServerName localhost:80 due to an error in the log.
error.log
[Fri Jul 09 07:05:21 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Jul 09 07:05:21 2010] [notice] Child 4108: Exit event signaled. Child process is ending.
[Fri Jul 09 07:05:22 2010] [notice] Child 4108: Released the start mutex
[Fri Jul 09 07:05:23 2010] [notice] Child 4108: All worker threads have exited.
[Fri Jul 09 07:05:23 2010] [notice] Child 4108: Child process is exiting
[Fri Jul 09 07:05:23 2010] [notice] Parent: Child process exited successfully.
[Fri Jul 09 07:06:23 2010] [notice] Apache/2.2.15 (Win32) PHP/5.2.13 configured -- resuming normal operations
[Fri Jul 09 07:06:23 2010] [notice] Server built: Mar 4 2010 11:27:46
[Fri Jul 09 07:06:23 2010] [notice] Parent: Created child process 3520
[Fri Jul 09 07:06:23 2010] [notice] Child 3520: Child process is running
[Fri Jul 09 07:06:23 2010] [notice] Child 3520: Acquired the start mutex.
[Fri Jul 09 07:06:23 2010] [notice] Child 3520: Starting 64 worker threads.
[Fri Jul 09 07:06:23 2010] [notice] Child 3520: Starting thread to listen on port 80.
[Fri Jul 09 07:08:00 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Fri Jul 09 07:08:00 2010] [notice] Apache/2.2.15 (Win32) PHP/5.2.13 configured -- resuming normal operations
[Fri Jul 09 07:08:00 2010] [notice] Server built: Mar 4 2010 11:27:46
[Fri Jul 09 07:08:00 2010] [notice] Parent: Created child process 6584
[Fri Jul 09 07:08:00 2010] [notice] Child 6584: Child process is running
[Fri Jul 09 07:08:00 2010] [notice] Child 6584: Acquired the start mutex.
[Fri Jul 09 07:08:00 2010] [notice] Child 6584: Starting 64 worker threads.
[Fri Jul 09 07:08:00 2010] [notice] Child 6584: Starting thread to listen on port 80.
[Fri Jul 09 07:08:01 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Fri Jul 09 07:08:01 2010] [notice] Apache/2.2.15 (Win32) PHP/5.2.13 configured -- resuming normal operations
[Fri Jul 09 07:08:01 2010] [notice] Server built: Mar 4 2010 11:27:46
[Fri Jul 09 07:08:01 2010] [notice] Parent: Created child process 5780
[Fri Jul 09 07:08:01 2010] [notice] Child 5780: Child process is running
[Fri Jul 09 07:08:02 2010] [notice] Child 5780: Acquired the start mutex.
[Fri Jul 09 07:08:02 2010] [notice] Child 5780: Starting 64 worker threads.
[Fri Jul 09 07:08:02 2010] [notice] Child 5780: Starting thread to listen on port 80.
All pre-installation checks are perfect.
I even tried the PHP installers from the two currently available version but they don't let me start apache.
edit: It was able to install with mysqli the data samples.
try Disabling each extension in php.ini file to see which extension is causing the crash .most of the time the "Curl Extension" would be the reason for the Crash.