Session_start() errors


#1

So we just got setup w/ dreamhost, and are in the process of making sure everything works before we re-point our Domain to the Dreamhost DNS servers.

A few of our pages use $_SESSION, and are throwing up an error:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/site/site.com/new.php:2) in /home/site/site.com/new.php on line 24

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/site/site.com/new.php:2) in /home/site/site.com/new.php on line 24

Could this be because I am looking at it at
www.site.dreamhosters.com/new.php
rather than
actually looking at www.site.com

Or is it more likely to be something to do with a different version of PHP than was used on the old host? Something else?


#2

These error messages point to a preexisting issue with your site which may have been not displayed on your previous host. It’s caused by PHP files which try to output text before your application has fully started up, causing PHP to be unable to send certain important headers.

The most common cause of this issue is extra blank lines at the beginning or end of a file, like this:

[code]

<?php[/code] or, at the end of a file: [code] ?>

[/code]