Unexpected server reset with php and apache

I have an application that interacts with a database. Suddenly and sometimes the pages show me a Server connection Reset error in my web browser. More closely, access on the localhost page triggers a warning on avast.

If I refresh pages with Ctrl+R , this happens sometimes. PHP does not show any error messages, and it seems that the server needs more time to respond than usual.

I am using wamp with apache 2.4, PHP 5.4.3. I do not know where to start debugging or where the problem is.

 [Sun May 13 13:01:14 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Sun May 13 13:01:14 2012] [notice] Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8x configured -- resuming normal operations [Sun May 13 13:01:14 2012] [notice] Server built: May 13 2012 12:51:11 [Sun May 13 13:01:14 2012] [notice] Parent: Created child process 3660 Apache server interrupted... arn] Init: Session Cache is not configured [hint: SSLSessionCache] [Sun May 13 13:01:15 2012] [notice] Child 3660: Child process is running [Sun May 13 13:01:15 2012] [notice] Child 3660: Acquired the start mutex. [Sun May 13 13:01:15 2012] [notice] Child 3660: Starting 64 worker threads. [Sun May 13 13:01:15 2012] [notice] Child 3660: Starting thread to listen on port 80. [Sun May 13 13:01:15 2012] [notice] Child 3660: Starting thread to listen on port 80. [Sun May 13 13:01:28 2012] [notice] Parent: Received shutdown signal -- Shutting down the server. [Sun May 13 13:01:28 2012] [notice] Child 3660: Exit event signaled. Child process is ending. [Sun May 13 13:01:29 2012] [notice] Child 3660: Released the start mutex [Sun May 13 13:01:30 2012] [notice] Child 3660: All worker threads have exited. [Sun May 13 13:01:30 2012] [notice] Child 3660: Child process is exiting [Sun May 13 13:01:30 2012] [notice] Parent: Child process exited successfully. 

UPDATE:

When a connection request appears, if cachegrind used, it shows a partial list of calling methods. means that it does not run all the code. it shows some calls to require_once and what it is. next time, if I try again to get the page, the page executes and shows the entire column.

When a connection request appears, it shows

 18 different functions called in milliseconds (1 runs, 18 shown) 

after retrying

 220 different functions called in 329 milliseconds (2 runs, 220 shown) 

I do not know why it shows 2 runs. It also takes longer to complete the page. before he did it in less than 100 ms.

+7
source share
8 answers
  • Restart your computer and close / disable all running applications, including an antivirus that supports only the minimum set of running applications. Close everything, even those applications that you are sure cannot interfere - you never know.

  • Make sure PHP shows all errors / warnings:

     error_reporting(E_ALL); ini_set('display_errors', '1'); 

Make sure you look at every warning you get from PHP. This may give you a clue.

  • Try isolating the problem. Comment on the piece of code you suspect to cause the problem. Keep commenting until you get an error. Then start the split until you find the problem spot. This way you can isolate the problematic code, and once you see it, you can understand the problem.

  • Add a lot of statements that will be written to the log file (or just an echo). Then you can analyze the log file and understand at what point the error occurs, helping you isolate the problem ...

In the end, you will find the problematic code block and be able to track the problem. I hope :)

+1
source

to restart apache via php use the following code in php

 exec('/etc/init.d/httpd graceful'); 

and also look in manual ... and change the path to your httpd

0
source

Change apache listening port from 80 to 8080 httpd.conf file, change listen 80 to listen 8080 and restart apache

0
source

Try temporarily disabling antivirus again.

0
source

This may not be the right solution, but why not just try a different version of WAMP or maybe set up the system clock correctly ?. And have you tried running Apache in a minimal configuration? You can disable all extensions and modules (including php itself), and if the web server will work as expected, you can take turns modulating them one by one. I do not know about your environment, but you can also try to change the minimum number of worker threads and other values. I bet it doesn't help, but at least you will try.

0
source

If you have the mod_security feature enabled, try disabling it and see if this happens the same way. Sometimes you can have mod_security vigilance that just goes to http failure (sometimes it can be as simple as inserting ampersand data into the database) and win Don't write errors to the server logs, which makes troubleshooting difficult, it seems like you experience, I would disable the mod_security restart server and see if the behavior stopped!

0
source

It seems that some other people have faced the same problem using Wamp: Have you followed all the items listed in this post belonging to the official forum:

http://forum.wampserver.com/read.php?2,67660

0
source

Are you sure you don't have an include / require loop?

Such a loop causes PHP to consume too much memory, and apache kills itself to avoid this.

Or there may be some kind of 404 loop error ... Such a loop can happen if you sometimes make a 404 mistake. Here is an example:

You have a layout with a missing image, so it causes 404 errors. To display the page, 404 errors add a layout around the error page containing the missing image, which causes another 404 errors.

Hope this helps.

0
source

All Articles