Hey guys.

Well I'm getting that irritating warning on my site when loading up a specific page.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/d6ayr7/public_html/webdevelopment.php:1) in /home/d6ayr7/public_html/masterpage.php on line 2

I've encountered and solved this problem before by moving session_start() to the top of my script before anything is outputted to the browser. I still have session_start() before anything is called, yet I still recieve the warning.

webdevelopment.php

<?php
require_once 'masterpage.php';

$page_title = 'Web Development';
echo head($page_title);
.
.

masterpage.php

<?php
session_start(); 
.
.

This occurs when I load the page webdevelopment.php, and as you can see I am still not outputting anything to the browser before session_start(), yet I still recieve the warning.

Any ideas?

Recommended Answers

All 2 Replies

Are you sure there's no blank spaces before your opening <?php tag in either file? Even a single whitespace character (blank space, newline, tab) can throw this error.

I have had this type issue when I edited my PHP pages in MS WebExpression3. I viewed the file in notepad.exe and it did not display and issues, however, when I opend the page in Dreamweaver, I found garbage before the PHP opening <? tag. Once I removed the garbage, things worked fine.

Don't always trust your editor.

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.