Ok, I'm realy at a loss here. Our Website is powered by PHP for templating and other typical stuff. One day PHP started crashing for no reason. There arn't any errors in the logs and I can't narrow it down to when or where it's crashing. And, its JUST php, the server is still running and serving pages up like normal but it won't process PHP, just sends the php file. So, the users get a download box. I restart Apache and it works again but after a while it crashes again. It's random too, never after so many min. It'll happen about 10 seconds after the Apache restart and then it'll last for hours another time.

I've tried reinstalling PHP and Apache twice, both up to date. I made new configuration files for both PHP and Apache. I've used the recomended ini file for php and modified only a few options. Apache has a standard setup, vhosts etc..., nothing major.

I thought it could have been our code crashing it some how but it was all of a suddenly crashing. So, I had been working on a new system so I that going and it's doing the same thing. ALL new code.

I also found this "bogus" bug. We do use preg_replace, so I don't know if it could be the problem. So, I've tried rolling back to PHP 4.3.2, no luck.

Our setup:
Win 2k Server (up-to-date w/ patches)
Apache 2.0.48 (installed as a NT service)
PHP 4.3.4 (installed as a module)

I realy don't know where to go with this one, any help would be great. Thanks!

    Have you checked the Apache logs? They should tell you what the last thing that happened before it crashed was.

      Thats the wierd thing, there are no errors in the Windows log or Apache's. I havn't seen anything in the Apache logs right after I notice the issue that would hint to what the issue is. But, I have noticed this error in the logs quite a bit which I'm not sure what it is.

      (OS 64)The specified network name is no longer available. : winnt_accept: Asynchronous AcceptEx failed.

        Ok, now I think it has to be my code... We've setup a new server, new box and everything, and the same thing happend. The new server has completely different hardware and we started from scratch, no image or backup. So, everything is different and it still happens. I'm wandering if someone could check out my code to make sure it looks good and maybe test it on their server. ANY help would be greatly appreciated. Thanks

        PS. - Still no errors in the logs, only the Apache one from above.

          Ok, I've attached a zip file of our design and php code. You'll find all of the PHP code in assets/php/ Also, you'll find example pages in assets/php/ which is how the system is implemented.

          I took the files strait from our live server so that is what is being used at the moment.

          Kind of a quick overview, everypage includes the include file in the php folder. Then, there is a function in the to get the template parts.

          I know everything is kinda messy. I had to quickly throw together the code to get up. I'm working on cleaning up everything but we realy need to fix this crashing issue.

          Thanks

            Well, I've only had time to scan over them, but so far I find nothing wrong. Is there maybe a certain page you could narrow this to? Or maybe a function/class common to the pages that this has happened on?

              Nope, when PHP crashs the pages aren't processed anymore. So, I can't tell where it stopped, like at what point durring the script. This is very hard to trouble shoot... lol. Right now I'm going through each php file and making sure it looks right. I'm also going to redo the template file. For some reason I have a feeling in my gut that that's where it's coming from. Is there a good easy template system that I could use? All I need is a simple preg_replace type of system. Thanks for your help!

                Hummm......... I checked our Webpage and PHP only crashed for one subdomain. All the other domains, vhosts, are working. So, not I know it is crashing per vhost. Odd. Also, if you want to know, our Website is http://www.stma.k12.mn.us We are a school district in Minnesota, USA. Thanks

                  16 days later

                  I've thought of something that may be causing the issue. I have the template including a php file which contains a class. Now, when the file is included it would be inside a method of a class. Could this be causing the issue? Including a class decleration inside of a class?

                    11 days later

                    Well, I think it's safe to say I've fixed it now. Still not sure what it was but I completely rewrote the code. It still crashed after I implemented the new code but the old was still on there. I then went to Apache 1.3.x from 2.x and it hasn't crashed since (long while already). Anyway, I'm not sure what it was but it's fixed.

                      Write a Reply...