From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What does "headers already sent" mean?

What does "headers already sent" mean? - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

What does "headers already sent" mean?

One error message that's notorious for causing many hours of frustration, is headers already sent. Let's see what the problem is and how to fix it. I'm going to select a couple of flowers in this page here. And then click the Add to Basket button, and I've got an error message at the beginning. This page uses a PHP session and session variables. And the warning is, session_start): Cannot send session cache limiter - headers have already been sent. What headers already sent means is that some output has already been sent to the browser, so no changes can be made to the HTTP headers because they were already sent with the original output. As a result, the session can't be started. More important, without a session, you can't create or use session variables. I should point out that Zamp on Windows suppresses this problem through a configuration directive called output_buffering. I've added a .htaccess file to the chapter 07/07_05 folder to reset the buffer to zero because that's the way…

Contents