Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6556749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:59:04+00:00 2026-05-25T12:59:04+00:00

I have a problem with Session_start() here : Warning : session_start() [function.session-start]: Cannot send

  • 0

I have a problem with Session_start() here :

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at C:\xampp\htdocs\pages\home.php:4) in C:\xampp\htdocs\charts\home-chart.php on line 2

and in home-chart.php in line 2 I wrote codes like this :

session_start();
.
.
.
echo ' username: '.$_SESSION['user_name'];

although with this warning i can get result of $_SESSION['user_name'] but when I try to clear this part of the code :

session_start();

I can’t see any result in screen.
so, what’s your solution?

<?php
@session_start();
require_once '../class/chart.class.php';
$chart = new chart();
?>
<html>
    <head>
        <link href='../css/home-chart.css'  rel='stylesheet' type='text/css' />
    </head>
    <body>
        <div class='float_left' style="margin-bottom:20px;">
            <div class='float_left' style='line-height: 9.41px; font-size: x-small;'>0<br /></div>      <div class='float_left' style="background-image: url('../image/web/chart.png'); width: 367px; height: 226px; " >
                <!-- 1 --><div class='float_left float_left column' style='margin-left:2px;'>
                    <?php echo $chart->mysql_fetch($chart->daycal(-3)); ?>
                </div>  
                <!-- 2 --><div class='float_left float_left column'>
                    <?php echo $chart->mysql_fetch($chart->daycal(-2)); ?>
                </div>  
                <!-- 3 --><div class='float_left column' >
                    <?php echo $chart->mysql_fetch($chart->daycal(-1)); ?>
                </div>  
                <!-- 4 --><div class='float_left column' >
                    <?php echo $chart->mysql_fetch($chart->daycal(0)); ?>
                </div>  
                <!-- 5 --><div class='float_left column' >
                    <?php echo $chart->mysql_fetch($chart->daycal(1)); ?>
                </div>  
                <!-- 6 --><div class='float_left column' >
                    <?php echo $chart->mysql_fetch($chart->daycal(2)); ?>
                </div>  
                <!-- 7 --><div class='float_left column' >
                    <?php echo $chart->mysql_fetch($chart->daycal(3)); ?>
                </div>  
            </div>


            <div class='float_single_full' ></div>
            <div class='float_left bottom_chart' style="margin-left:10px;"><?php echo $chart->dayofweek(-3); ?></div>
            <div class='float_left bottom_chart'><?php echo $chart->dayofweek(-2); ?></div>
            <div class='float_left bottom_chart'><?php echo $chart->dayofweek(-1); ?></div>
            <div class='float_left bottom_chart'  style='font-weight:bold'><?php echo $chart->dayofweek(0); ?></div>
            <div class='float_left bottom_chart'><?php echo $chart->dayofweek(1); ?></div>
            <div class='float_left bottom_chart'><?php echo $chart->dayofweek(2); ?></div>
            <div class='float_left bottom_chart'><?php echo $chart->dayofweek(3);
                    echo ' username: ' . $_SESSION['user_name'];
                    ?></div>
        </div>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:59:04+00:00Added an answer on May 25, 2026 at 12:59 pm

    If you even have blank lines before the <?php tag, then you can’t set headers. Your start of file, with line numbers, should look like this:

    1. <?php
    2. session_start();
    3. header('Cache-control: private');
    

    The message says “headers sent at line 2”, so you’re outputting something (a space, a blank line, whatever) on line 4 of home.php

    If this file is an include, you should put your session_start(); at the top of home.php instead, and then you don’t need it in this file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: php headers already sent error I have attached my code which am
Here is my problem, I have a PHP SESSION but it disappears... That's my
I have problem with session in cakephp.I have one file chat.php that is in
i have a problem with session in my webapplication (asp.net mvc rc2). the application
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']
Weired problem! ASP.NET Session expires instantly. In my web.config I have this session settings:
I have a nHibernate query like this ICriteria query = session.CreateCriteria(typeof(MyResult)) .Add(Expression.Eq(ResultTypeId, myResult.ResultTypeId)) Problem
I have a problem wtih session_start() on primary server. When I load page for
There is a problem with session variables in my web-application. I have several types
Please review this Stackoverflow post. I have the same PHP problem as bob_cobb. Here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.