Jump to content
djarvinen

Warning message "headers already sent" after refresh when I added simple hover

Recommended Posts

The actual message is:

"PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent "

I didn't get this message until I added the following code (and if I remove the code, I no longer get the message):

CSS
.thumbnail:hover {
    position:relative;
    top:-25px;
    left:-35px;
    width:500px;
    height:auto;
    display:block;
    z-index:999;
}

HTML
<img src="images/condo0.jpg" class="thumbnail" height="150" />

Normally I would just ignore the error but it adds the message to the logfile every time 'refresh' is executed,  and will eventually overwhelm the log file.

 

These are the first three lines of my php file on the off-chance they are relevant to the error:
<?php
ob_start();
session_start();

Any ideas?

Thanks.

(edit)
two images inadvertenlty added which should not be here.  Newb, sorry.

 

image.png

image.png

Edited by djarvinen
Newb error; didn't know how to remove images.

Share this post


Link to post
Share on other sites

The php session code should be at very top before ANY html including the doctype and there must be no spaces empty newlines above it

<?php
ob_start();
session_start();
?>
<!DOCTYPE html>

 

Share this post


Link to post
Share on other sites

My bad, and my apologies; that was exactly the problem.  I had included the wrong 'config' file at the beginning of my code.

Although I still don't know why it would only manifest itself after adding the 'hover' code.  :(

But thanks.

Edited by djarvinen

Share this post


Link to post
Share on other sites

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

×