0

I'm having a slight problem and I hope you may be able to help me. I'm not a programmer or a coder but I just want to fix some troubles with my project.

Here is the context. I need to install and use one of my project (eCommerce website) offline on my notebook (HP - Windows7). So I have already installed Appserv and import the databases. I also copy paste all the files in the www/name of the project folders. The website is in PHP and Javascript. No CMS and the CSS templates have been designed internally.

I started the website offline using localhost and I opened the admin log in page. I entered my Log in and password and I got the following message:

*" Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\thailema_v2\controller\admin\login.php:1) in C:\AppServ\www\thailema_v2\controller\admin\login.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\thailema_v2\controller\admin\login.php:1) in C:\AppServ\www\thailema_v2\controller\admin\login.php on line 18 "*

So I couldn't reach my admin page and relaunch offline the functions I need. I have already read and tried some proposed solutions here but it did not change and there are some solutions I couldn't figure out as I'm not a professional programmer.

Anyway here is the code of the page:

<?php
ob_start();
session_start();
$path = '../';
include_once($path."include/check_lang.inc.php");
include_once($path."include/connect.php");
include_once($path."include/login.class.php");

$objLogin=new Login();
$check=$objLogin->getLogin($_POST["customer_username"],$_POST["customer_password"]);

if($check){
    $url = $path."add_booking_info.php?lang=".$lang;
}else{
    $url = $path."payment_step1.php?error=yes&lang=".$lang;
}

header("Location: ".$url);
ob_end_flush();
?>

So what I want to do is to log in the admin pages and use all the admin functions but at the moment I cannot even access the admin index pages because of that error. Thanks a lot for your help and support...

Olivier

2 Answers 2

3
  1. Make sure there is absolutely no whitespace before <?php

  2. Put session_start() before ob_start() instead of after it.

  3. If that fails, try commenting out the session_start() as one of your includes might already be starting the session, like so: /** session_start(); **/

7
  • Hi Joe. Thanks for your message... I did the modifications and restart apache server but I still got the same message. There is no whitespace before <?php Aug 6, 2014 at 8:13
  • Still getting both errors? (ie, about the session cache, and about modifying header info) or just one? if just one, which one? Aug 6, 2014 at 8:17
  • Still both errors Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\thailema_v2\controller\admin\login.php:1) in C:\AppServ\www\thailema_v2\controller\admin\login.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\thailema_v2\controller\admin\login.php:1) in C:\AppServ\www\thailema_v2\controller\admin\login.php on line 18 Aug 6, 2014 at 8:20
  • I wonder if one of your includes is already starting the session... try commenting out the session_start and see if that does anything, at least to the first error. Aug 6, 2014 at 8:22
  • What do you mean by commenting out the session? Sorry for the question... but I'm not a programmer... Aug 6, 2014 at 8:29
-1

I had the same similar problem. When I uploaded from my pc to my online webhost i got the same error. I removed any whitespace, put the session_start at the top of the file, but with no result. Then looked at my php version running on my localhost. And it was 5.4 and online it was 5.3. I updated my webhost version from 5.3 to 5.4 and my problem was gone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .