Hello,

I am having this error message:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\xampp\htdocs\rustoleum\index.php:8) in C:\xampp\xampp\htdocs\rustoleum\index.php on line 63

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\xampp\htdocs\rustoleum\index.php:8) in C:\xampp\xampp\htdocs\rustoleum\index.php on line 63

index.php

<?php
// Put this code in first line of web page.

session_start();
session_destroy();

?>

line 63: session_start();

This is strange, this code is for: Rustoleum

After I download it offline to run it in my localhost, that error start appearing.

any idea why?

Thanks before.

Recommended Answers

All 2 Replies

After I download it offline to run it in my localhost, that error start appearing.

What do you mean by that? You can not download PHP code from a web page, can you?

Anyway, the error you are getting means that you are sending some HTML output before the session_start function. You can not do that since session_start sends a cookie and cookies are a part of a header. And header directives have to be sent before any HTML output. This includes any spaces that maybe you do not see in your code, as well as included files that also should not send HTML before headers. The solution is to put the session_start function on the very beginning of the code (as it says in the comment).

Thanks, it now works.

Well, it's my codes by the way. I download it through the control panel.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.