PDA

View Full Version : Apache, WTF ARE YOU DOING?



Rob Oplawar
June 11th, 2008, 10:58 PM
Ok, so everyone knows I'm a web developer who works primarily in PHP. I've got a server configured on my desktop computer using XAMPP version 1.6.2, which is running Apache version 2.2.4, which is in turn running PHP 5.2.2.

Hokay, so, I'm trying to teach myself how to use the declare (http://us3.php.net/manual/en/control-structures.declare.php) control structure.

Here's my code I'm working with (I've reduced it to the bare minimum to cause this problem I'm having):


function profile() {}
register_tick_function('profile');
declare(ticks=1):
$do=$someting="anything"; //it doesn't matter
enddeclare;

This doesn't produce a parse error, or a compiler error, or a runtime error, nor any sort of error in PHP (that I can detect).
No, it goes straight for the throat: It causes Apache to crash! What sort of PHP script can actually behead Apache? This code I'm running can't possibly be bad because it's definitely something that's done frequently. So something's wrong with Apache.

Check out my Apache log file:


[Wed Jun 11 20:42:25 2008] [notice] Apache/2.2.4 (Win32) SVN/1.4.3 DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.2 configured -- resuming normal operations
[Wed Jun 11 20:42:25 2008] [notice] Server built: Mar 5 2007 11:23:00
[Wed Jun 11 20:42:25 2008] [notice] Parent: Created child process 6020
[Wed Jun 11 20:42:27 2008] [notice] Child 6020: Child process is running
[Wed Jun 11 20:42:27 2008] [notice] Child 6020: Acquired the start mutex.
[Wed Jun 11 20:42:27 2008] [notice] Child 6020: Starting 250 worker threads.
[Wed Jun 11 20:42:27 2008] [notice] Child 6020: Starting thread to listen on port 443.
[Wed Jun 11 20:42:27 2008] [notice] Child 6020: Starting thread to listen on port 80.
[Wed Jun 11 20:42:39 2008] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Wed Jun 11 20:42:41 2008] [notice] Apache/2.2.4 (Win32) SVN/1.4.3 DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.2 configured -- resuming normal operations


But it gets better. I was screwing with my code, trying to track down what line was causing Apache to crash (it's the tick, function, by the way. The moment the tick function gets called on a tick (and not manually), Apache crashes), and I got an even stranger error.

I had some trace echo statements in my code, and the page loaded and the first few traces showed up, and then I got a fatal error in PHP.
I should have screencapped or copy and pasted, cause I can't remember the full error text, but I'm pretty sure this is the exact text of it:


Fatal error: Class 'containeH1' not found in C:\Documents and Settings\Rob Oplawar\My Documents\workspace\tortoise\test.php on line 75

I had a class called "container" in my code. I use H1 a lot in my HTML (it's a header text tag), but it was nowhere in this file. In fact, it wasn't anywhere in the whole project. The nearest H1 is buried in a subdirectory of a sibling to the tortoise directory. How the fuck did it get in my PHP???
:confused:




... after all that error ranting, I finally did a *proper* google search, and found the related PHP bug report:
http://bugs.php.net/bug.php?id=26771
Apparently, I'm boned if I'm using Apache with threads in Windows.
What the fuck, PHP?! You have a fucking bug that's been around since version 4 that you are completely aware of and that causes your server to crash under some circumstances but not all, so if a site happened to switch servers it would suddenly kill not only itself but also any other website hosted on that server????

WHAT.

THE.

FUCK.

Sel
June 12th, 2008, 08:04 AM
Its clearly because apache is as much fun as you :downs:

Me being an absolute know nothing on this, all I can really say is that in the last thing, you spelled contain wrong :\

klange
June 13th, 2008, 07:09 PM
May I ask what you're using a declare statement for?

Rob Oplawar
June 14th, 2008, 05:57 PM
I was going to use it to profile the relative amount of cpu time functions were taking. I decided that microtime() will do well enough, even though it's going to be biased by context-switching. =/