Jump to content

[SOLVED] Help with Header error


limitphp

Recommended Posts

I just uploaded my website to my live server.

The address is www.greckle.com

Its giving me the error:

Warning: Cannot modify header information - headers already sent by (output started at /home/greckle0/public_html/connGreckle.php:11) in /home/greckle0/public_html/index.php on line 26

 

on line 26 I have this:

setcookie("time",$time, 0);

 

It works perfectly fine on the test server on wamp server 5.2.6

 

I did notice on my live server with lunarpages, it said php 4. something.....it wasn't version 5.

 

Does anyone know why I'm getting this error?

Link to comment
Share on other sites

Yes.  I do check for a cookie.  Here's the whole section:

//******************	HANDLE TIME	********************
//Get Existing time Value
if($_GET['time'])
  $time = $_GET['time'];
elseif($_COOKIE['time'])
  $time = $_COOKIE['time'];
//Validate
if(empty($time) || !is_numeric($time) || $time>365){
  $time = 7;
}
//Set Cookie for next time
setcookie("time",$time, 0);   //LINE 26
//***********************************************

Whats wierd is, it works perfectly fine on wamp server.

 

 

Link to comment
Share on other sites

That error means that you had some sort of output before the call to setcookie().  No output at all is permitted. ;)

 

Here's the code up to that point:

<?php 
include("connGreckle.php"); //LINE 1
$mode = $_POST['mode'];
$logout = $_GET['logout'];
$rememberMe = $_POST['remember'];	
$username = check_input($_POST['username']);
$password = check_input($_POST['password']);
$loginExist = 0;
$loginFailed = 0;
$genreList = "'Alternatve','Rock','Punk','Indie','Folk','Jazz','Blues','Reggae','RB','Pop','Country','Christian','Latin','Techno','Hip-Hop','World','Vocal','New Age'";

$allRock = $_POST['allrock'];
$allGenres = $_POST['allGenres'];

//********	HANDLE TIME	****************************
//Get Existing time Value
if($_GET['time'])
  $time = $_GET['time'];
elseif($_COOKIE['time'])
  $time = $_COOKIE['time'];
//Validate
if(empty($time) || !is_numeric($time) || $time>365){
  $time = 7;
}
//Set Cookie for next time
setcookie("time",$time, 0); //LINE 26

 

I don't think there is any output before that cookie call?.......

 

Link to comment
Share on other sites

First of all, line 1 in that script is <?php.  PHP's line numbers correlate exactly to a line in the file, not in the PHP tags.  Second of all, with my telepathy and mind-numbingly incredible genius, I deduce that you have your editor set to save files in UTF-8.  Look for an editor setting involving the UTF-8 BOM (byte order mark).

Link to comment
Share on other sites

First of all, line 1 in that script is <?php.  PHP's line numbers correlate exactly to a line in the file, not in the PHP tags.  Second of all, with my telepathy and mind-numbingly incredible genius, I deduce that you have your editor set to save files in UTF-8.  Look for an editor setting involving the UTF-8 BOM (byte order mark).

 

I'm sorry...you are correct.....

the <?php was line 1.

 

my mistake...I told you guys wrong.....sorry.

Link to comment
Share on other sites

Edit: Wrote this before you made your last post DW.

 

From the error message -

 

output started at /home/greckle0/public_html/connGreckle.php:11 (line 11)

 

Please read error messages. Sometimes they tell you not only what the problem is but where it is being caused at.

Link to comment
Share on other sites

My incredibly mind-numbing genius was on break when I made that post though.  I didn't read the orig. error closely enough.  It said the output was in connGreckle.php on line 11.  Sorry. xD

 

So, comments are considered output....

 

No, they're not.  You must have not commented properly. o_O  Unless it was an HTML comment, lol.  THOSE are considered output.

 

@PF:  No problem. ;)

Link to comment
Share on other sites

My incredibly mind-numbing genius was on break when I made that post though.  I didn't read the orig. error closely enough.  It said the output was in connGreckle.php on line 11.  Sorry. xD

 

So, comments are considered output....

 

No, they're not.  You must have not commented properly. o_O  Unless it was an HTML comment, lol.  THOSE are considered output.

 

@PF:  No problem. ;)

 

Yeah...they were probably html comments.  I don't remember.  They are gone now anyway. : )

I wonder why it worked perfectly on wamp server, though?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.