Page 1 of 1

same file, different name - one causes error, but not other

Posted: Wed Jul 25, 2007 1:23 pm
by Luke
I've got two files... one is named admin_index.php and the other is named poster_index.php. They contain the SAME EXACT THING.

Code: Select all

<?php

	//GLOBALS
	//replace this with var from global array/.ini file
	$embedded = false;
	$page = "Administration";

	//INCLUDES
	require_once('includes/pageutils.php');
	admin_page();

	//CODE
	if (!$embedded)
	{
		html_open();
		html_head($page);
	}

	temp_nav_bar($page);
	
	nav_bar_button($page, "Company and Post Administration", "createaccount.php", "Create New Account");
	nav_bar_button($page, "Company List", "account_edit.php", "Account List");
	nav_bar_button($page, "Manage Keywords/Categories", "keywords.php", "Keyword List");	
	
	//login_list();

	if (!$embedded)
		html_close();
?>
when you access admin_index.php, it works just fine. When you access poster_index.php, you get the following error
error wrote:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/bla/user/jobs/poster_index.php:1) in /var/bla/user/jobs/connect.php on line 3
I LITERALLY selected ALL from the admin_index file, copied & pasted into the poster_index file... and one gets an error... the other does not. this is making me want to punt babies out of an airplane. What in the WORLD could cause this? :evil:

Posted: Wed Jul 25, 2007 1:25 pm
by superdezign
An invisible character at the start of the new file.

Posted: Wed Jul 25, 2007 1:27 pm
by Luke
an "invisible character" ? I copied the one file EXACTLY... and I've copied and recopied and recopied and recopied, deleted the file, started it again, typed it in manually... it's DRIVING ME NUTS.

Posted: Wed Jul 25, 2007 1:29 pm
by superdezign
It's likely the program you are using. Try Visual Studio or Notepad.

Copy everything but the first character (<), and then just type that in manually.

Posted: Wed Jul 25, 2007 1:35 pm
by miro_igov
Try placing session_start(); at the first line of poster_index.php and temporary remove it from connect.php

If the admin_index.php and poster_index.php are in diferent dirs check the .htaccess file if any. Sometimes people set auto_prepend_file.

ob_start() may help but will not give an answer why it happens.

Posted: Wed Jul 25, 2007 1:35 pm
by Luke
yep that was it... stupid notepad++

that sucks, cuz I was liking this app :(

EDIT: this was in response to superdezigns

Posted: Wed Jul 25, 2007 1:37 pm
by volka
It was probably a BOM. You can disable this marker in notepad++

Posted: Wed Jul 25, 2007 1:41 pm
by Luke
volka! I hadn't thought of that (I still am pretty green on encoding stuff)... that is exactly what it was. :) thanks!