Premature end of script headers: index.php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Premature end of script headers: index.php

Post by simonmlewis »

What is this?
I'm being told this is one thing causing our site to run slow or crash.

It would really help if it gave me a line number in that file.
At the very top we have

Code: Select all

<?php session_start(); 
?>
And use to have a

Code: Select all

if(isset($_REQUEST['itemtype']))
{
    $itemtype = $_REQUEST['itemtype'];
    $_SESSION['itemtype']=$itemtype;
} else { $itemtype=$_SESSION['itemtype'];
}
if ($itemtype == NULL) { $itemtype = "Shirts";}
if(isset($_REQUEST['sort']))
{
    $sort = $_REQUEST['sort'];
    $_SESSION['sort']=$sort;
} else { $sort=$_SESSION['sort'];
}

if($sort == NULL) { $sort=title; }
This script would only be used by Administrators tho, which doesn't explain why it's happening via a referred product page. But could it be that it's calling this countless times, with no reason?

Also, what is this:

Code: Select all

[Sat Mar 16 17:45:10 2013] [error] [client 2.218.254.138] File does not exist: /home/site/public_html/facebox, referer:
The referring is one of our web pages, and yes it does use facebox for some popups. But it works - so why does something not exist? The folder certainly does.

And finally, we are seeing this too:

Code: Select all

[Sat Mar 16 17:58:47 2013] [error] [client 86.151.101.59] File does not exist: /home/site/public_html/graphics, referer:
There is nowhere in my code that states '/graphics'. So why is it something looking for it. I guarantee you my code doesn't look for it.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Premature end of script headers: index.php

Post by Jade »

What error are you getting? You mention it but you haven't posted it anywhere. If there's a space or any kind of text output before your session_start() that can cause the page to not load properly. Also make sure you have error reporting turned on in your php_ini file.

The things you posted from your log file are a client's or bot's attempt to load an incorrect url -- it has nothing to do with the page not loading correctly.
Post Reply