dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Headers already sent?

  1. #1
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337

    Headers already sent?

    hi, I made a style sheet that the content is generated via SQL info. It woks fine on test servers in the office, but on a live site, it always says the headers are already send.
    Warning: Cannot modify header information - headers already sent by (output started at /home/df420/public_html/somedir/template/style.php:1) in /home/df420/public_html/somedir/template/style.php on line 1
    And here is the first 50 lines of the file.
    PHP Code:
    <?php header('Content-type: text/css');
    require_once(
    '../includes/settings.php');
    require_once(
    '../includes/db.inc.php');
    require_once(
    '../includes/style.inc.php');
    $s $style->getStyle();?>
    /* Dynamic CSS Document */
    html{
    <?php
    foreach($s['html'] as $a){
        echo 
    $a['attribute'].':'.$a['value'].';'."\n";
    }
    ?>
    }
    body {
        font-size: 10pt;
        margin: 0 0 0 0;
        font-family: Myriad Pro, Tahoma, Verdana, Arial, Helvetica, sans-serif;
    }
    h2{
    <?php
    foreach($s['h2'] as $a){
        echo 
    $a['attribute'].':'.$a['value'].';'."\n";
    }
    ?>
    }
    h3{
    <?php
    foreach($s['h3'] as $a){
        echo 
    $a['attribute'].':'.$a['value'].';'."\n";
    }
    ?>
    }
    th {
        text-align: left;
    }

    td {
        padding: 0px 0px 0px 0px;
    }

    div.main {
        width: 1000px;
        margin: 0px auto 0px auto;
    }

    td.top_left {
        background: url("../images/template/top_left.png");
        width: 244px;
        height: 157px;
    }

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,299
    If the file is saved as UTF-8, make sure it is saved wtihout a BOM (byte order mark), which would be output before your opening <?php tag (or just save it as plain ASCII text if you don't really need the extended UTF-8 character set).

    If that's not it, is it possible your web host has an auto_prepend_file configured in your php.ini settings (or apache config/.htaccess) which might be generating output?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337
    Awesome, it was the encoding. Thanks a lot.

    EDIT: Just out of curiosity, why would it be fine locally and not work remotely?
    Last edited by NoEffinWay; 01-30-2013 at 11:03 AM.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,299
    Possibly something to do with the FTP client or file upload page you used to deploy it to the web host?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles