Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dhenter/public_html/zshop/index.php:6)

How could i solve this issue?

check this link please: http://d-h-enterprise.com/zshop/

post your php code of index.php file

index.php

<?php include "db.php";?>
<?php include "configuration.php";?>				
<?php include "menubar.php";?>
<?php include "library.php"; ?>				
<?php 
	@$script = trim($_REQUEST['script']);
	
	switch($script)
	
	{
	    case 'adminMenu': include "admin.php";
			break;
			
		case 'ContactUs': include "ContactUs.php";
			break;
	    case 'signin-form': include "userLogInForm.php";
			break;
		case 'login_c': include "login_c.php";
			break;
	    case 'home': include "home.php";
			break;
		case 'signup-form': include "signup-form.php";
			break;
		case 'returnProductsMemo': include "returnProductsMemo.php";
			break;
		case 'registerAction': include "registerAction.php";
			break;
		case 'print_opbalClrForm': include "print_opbalClrForm.php";
			break;
		case 'logOut': include "logout.php";
			break;
		case 'DailySalesReportAction': include "DailySalesReportAction.php";
			break;
		case 'ReportSalesAction': include "ReportSalesAction.php";
				break;
		default: include "userLogInForm.php";
			break;
			
			
	}
?>				
<?php include "footer.php";?>

db.php

<?php
 $link = mysql_connect("localhost", "dhenter_user", "dhe#@11")
    or die("Could not connect: " . mysql_error());
  mysql_select_db('dhenter_db', $link)
    or die ( mysql_error());

?>

post your php code of index.php file

index.php

<?php include "db.php";?>
<?php include "configuration.php";?>				
<?php include "menubar.php";?>
<?php include "library.php"; ?>				
<?php 
	@$script = trim($_REQUEST['script']);
	
	switch($script)
	
	{
	    case 'adminMenu': include "admin.php";
			break;
			
		case 'ContactUs': include "ContactUs.php";
			break;
	    case 'signin-form': include "userLogInForm.php";
			break;
		case 'login_c': include "login_c.php";
			break;
	    case 'home': include "home.php";
			break;
		case 'signup-form': include "signup-form.php";
			break;
		case 'returnProductsMemo': include "returnProductsMemo.php";
			break;
		case 'registerAction': include "registerAction.php";
			break;
		case 'print_opbalClrForm': include "print_opbalClrForm.php";
			break;
		case 'logOut': include "logout.php";
			break;
		case 'DailySalesReportAction': include "DailySalesReportAction.php";
			break;
		case 'ReportSalesAction': include "ReportSalesAction.php";
				break;
		default: include "userLogInForm.php";
			break;
			
			
	}
?>				
<?php include "footer.php";?>

db.php

<?php
 $link = mysql_connect("localhost", "dhenter_user", "dhe#@11")
    or die("Could not connect: " . mysql_error());
  mysql_select_db('dhenter_db', $link)
    or die ( mysql_error());

?>

problem is in configuration.php, do not echo or print in configuration. Or do not write any html code in it.

problem is in configuration.php, do not echo or print in configuration. Or do not write any html code in it.

here is my configuration.php

<?php if(!session_start()) session_start();
	//if(!isset($_SESSION['VisitorID'])) $_SESSION['VisitorID'] = 4;?>

Post your code where the 'session_start()' was used. 'session_start()' normally should write at the top of the PHP file before processing any PHP codes.

here is my configuration.php

<?php if(!session_start()) session_start();
	//if(!isset($_SESSION['VisitorID'])) $_SESSION['VisitorID'] = 4;?>

Only this much? Is it complet code

<?php if(!session_start()) session_start();
//if(!isset($_SESSION)) $_SESSION = 4;?>

Try this one:

<?php 
session_start();
?>

Post your code where the 'session_start()' was used. 'session_start()' normally should write at the top of the PHP file before processing any PHP codes.

I have posted my configuration.php

I have tried and shows this below msg:

Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in /home/dhenter/public_html/zshop/configuration.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dhenter/public_html/zshop/index.php:6) in /home/dhenter/public_html/zshop/configuration.php on line 3

you can find it by this link http://d-h-enterprise.com/zshop/

Post this file '/home/dhenter/public_html/zshop/configuration.php'

I have posted before after getting your request I made changes over there now it is here below:

<?php
    session_start();
    ?>

thats all. nothis is there except these code

<?php include "db.php";?>
<?php include "configuration.php";?>

<?php include "configuration.php";?>

Place thine line first before <?php include "db.php";?> . As I mentioned above, 'session_start()' should write first before processing other PHP statements.

its not working. no change

Ensure that there is no empty space between the PHP delimiter. Clear white spaces and empty line. Like this one:

<?php
session_start();
?>

Make sure that you check all of your includes and make sure that there are no extra lines before or after the opening an closing <?php ?> tags. In notepad this is often hard to see. If you cursor goes past the closing tag make sure you delete everything (even the carraige return) after the closing tag.

This was the most popular reason why my students session_start() would fail.

Also, in the configuration.php file the closing tag is missing as it is being commented out. While the closing tag is not necessary it probably should be there.

http://choosetheforce.blogspot.com/2008/05/should-you-close-that-php-tag.html

Member Avatar for diafol

How about:

@$script = trim($_REQUEST['script']);

to

$script = @trim($_REQUEST['script']);

However, $_REQUEST should be discouraged, try to use the right superglobal e.g. $_GET, $_COOKIE or $_POST.

The whole reason you're getting this (I assume) is that your header() comes after page output has started - line 6 may be throwing an error.
It's best to have your header() at the top of the file if possible.

Thanks all of you. My issue is solved. Thanks again.

Member Avatar for diafol

PLease mark the thread solved by clicking the link below.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.