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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

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

Post 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:
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

An invisible character at the start of the new file.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post 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.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

yep that was it... stupid notepad++

that sucks, cuz I was liking this app :(

EDIT: this was in response to superdezigns
Last edited by Luke on Wed Jul 25, 2007 1:35 pm, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

It was probably a BOM. You can disable this marker in notepad++
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

volka! I hadn't thought of that (I still am pretty green on encoding stuff)... that is exactly what it was. :) thanks!
Post Reply