I'm managing a site at this time on network solutions small unix server. This really is my clients choice, not mine. Allows assume altering isn't a choice at this time.

I get a higher quantity of 500 internal server error occurrences. They're sporadic, but clearly happening far too frequently. There is not much consistency as to the pages trigger the mistake but it's happening an excessive amount of which is very frustrating.

When it comes to establishing servers and playing around with configurations...well, I do not cash knowledge about that kind of factor...usually things i do works.

Okay I've enabled errors here is things i received:

[Get married 12 , 14 23:56:04 2011][error] [client *] Premature finish of script headers: index.php, referer: mysite.com/administration/

Here's my code for your page:

//start the session
if (isset($_SESSION['user_id'])) {

$menu_bar = false;
$login_form = true;
$status = 'Please Log in';
$header_message = 'Welcome to the mysite Administartion System';

if (isset($_POST['submit'])) {



if (isset($_GET['redirect'])){

    switch ($_GET['redirect']) {

            case 'denied':
            $header_message = 'The page you have tried to access is forbidden, please login';

            case 'logout':
            $header_message = 'You have logged out successfully';




Here is utilities/login.php

if (!isset($_SESSION['user_id'])) {

     $username = mysqli_real_escape_string($dbc, trim($_POST['username']));
     $password = mysqli_real_escape_string($dbc, trim($_POST['password']));

      if (!empty($username) && !empty($password)) {
        // Look up the username and password in the database
        $query = "SELECT id, username, password FROM user WHERE username = '$username' AND password = SHA('$password')";
        $data = mysqli_query($dbc, $query);

          if (mysqli_num_rows($data) == 1) {
          // The log-in is OK so set the user ID and username session vars (and cookies), and redirect to the home page
          $row = mysqli_fetch_array($data);

          $_SESSION['user_id'] = $row['id'];
          $_SESSION['username'] = $row['username'];

          // The username/password are incorrect so set an error message
          $message = 'Sorry, you must enter a valid username and password to log in.';

         else {
        // The username/password weren't entered so set an error message
          $message = 'Please enter a username or password to login.';

The mistake 500 is simply too general which is impossible to extract any significant information from it.
Which is an internet-server's error message.
While for that reason of the error you need to obtain the PHP error message somewhere.
It is almost always drenched within the web-server error log.
Thus, you need to look towards the server's error log to create yourself enlightened from the certain reason for the issue.

Note towards the fervent other staff: This may be the answer. The only possible answer towards the "I get 500 error" question.

Now, towards the edited area of the question.
This really is still inadequate error message but still on the internet-server part.
But you just must have the PHP error message. Means PHP just died with no output. However it need to problem a mistake message around the cause.
Make certain you've errors elevated and drenched.
check phpinfo() output for that error_reporting (ought to be non-zero), 'log_errors' and error_log parts, and proper them accordingly.