Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

php code problem server?

when I test my code on local computer, works beautifully, almost too perfect. When I test it on server, works like ****, getting these errors out the gate:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/farruk23/public_html/index.php:3) in /home/farruk23/public_html/core.inc.php on line 4

Database Error

Warning: Cannot modify header information - headers already sent by (output started at /home/farruk23/public_html/index.php:3) in /home/farruk23/public_html/loggedin.inc.php on line 4

5 Answers

Relevance
  • Anonymous
    9 years ago
    Favorite Answer

    And your question is...?

  • 9 years ago

    Look at the error the answer is there.

    If you'll notice the error is "headers already sent "

    You are modifying header info in index.php.

    However in core.inc.php there is an error on line 4.

    And this text "Database Error" is being sent to the browser. That's why you get the header already sent error. There is a problem with your database connection or string. you need to look at that.

    What you should be doing is suppressing the error.

    And then logging the error to a file, database or sending you the error via email or somethign similar so you don't see those warnings.

  • ?
    Lv 7
    9 years ago

    You are using session_start and, probably, setcookie() or header() somewhere in your code.

    YOU CANNOT...

    Read the warnings at http://www.php.net/ and apply them.

    These functions CANNOT be used after you have sent ANY character to the user's machine - not even a space or the <html> tag.

    Source(s): http://web2coders.com/ - free php scripts
  • ?
    Lv 5
    9 years ago

    I've found this issue a couple of times, and have no idea why it occurs. My code is correct, as it runs on my localhost perfectly. However, uploading it to my remote server makes it break. I have, however, discovered a completely non-technical solution. Copy all of your pages code into a blank document, delete the original, and rename the new one. I find that I have to delete the remote version before uploading it, and sometimes even have to name the new version something different. I know this isn't a solid answer, but it solved my issues, and I hope it will help you.

    If it does not, feel free to send me your pages full code, and I'll check the syntax myself to see if I can spot any flaws.

    I hope this helps.

  • Anonymous
    9 years ago

    Try putting <?php session_start()?> as the first thing on the page, and see it that fixes the problem.

Still have questions? Get your answers by asking now.