Jump to content

Recommended Posts

Posted

I am curious why, after a certain amount of time, the server (stevie) seems to unload PHP from memory, resulting in all requests for a PHP document generating 500 errors for a short while. My site has low traffic, but many of my pages use PHP, and so when a visitor does come along, the see 500 errors, which could lead them to think that my site is dysfunctional.

Posted
the server (stevie) seems to unload PHP from memory

 

Generally speaking when you get a 500 error the opposite is the case, when the server encounters a user's site reaching beyond the user's process limits it'll start to serve 500 errors. Check your code to make sure that you didn't accidentally set up an infinite loop or that you left pages without ?> tags.

Posted

I am careful to avoid infinite loops on my site, since that would obviously cause problems. As for pages without ?>, I intentionally do that for the pages that are purely for PHP code to prevent accidental output of extra whitespace. I was wondering why it was happening because my site goes from effectively no traffic to some traffic, but I get 500 error from only the PHP scripts, regardless of complexity or location (even `<?php echo "It Works!"; ?>` would fail). Without any modification, they work a small amount of time later (about a mintute or two)

Posted
but I get 500 error from only the PHP scripts, regardless of complexity or location (even `<?php echo "It Works!"; ?>` would fail). Without any modification, they work a small amount of time later (about a mintute or two)

 

Yeah, as long as the unclosed pages are opened they keep the PHP interpreter loaded in memory until the system realizes it's just wasting that space and kills it. So after a slight delay eventually you do start seeing the expected PHP output, but while extraneous instances are running your site will serve 500 errors.

Posted

actually no, there's no need to put ?> in your php, many frameworks/cms don't put one, and php interpreter is not kept in memory

server passes the file to php, php parses until eof and returns output, it doesn't sit in the background waiting for closing tag

 

my guess the reason you sometimes get 500 error is too many requests to the server

Posted

The same thing happens to me. I am using a forum on my site (phpbb), and even it produces errors..... I don't think many people visit my site at all. In fact, only me and like 2 other people...

Posted

I finally managed to get this error while testing a text editor running through a textarea. In my case I originally had the script output through the textarea's value attribute which ended up a little broken. When i simplified it to

<textarea cols="80" rows="25" id="TEXT">
<?php if(isset($_POST['open'])){
if(isset($_POST['file'])){
echo file_get_contents($_POST['file']);
}
} ?>
</textarea>

I had left out the closing php tag and after opening a couple files, got the error. I waited a couple minutes, went into the source and put the missing tag and haven't gotten the error again.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...