/    Sign up×
Community /Pin to ProfileBookmark

WHY! session error -.-

The 1st three lines of ‘index.html’

[code=php]<?php require “phpinclude/functions.php”; Check_Search(); ?>
<!DOCTYPE html>
<html xmlns=’http://www.w3.org/1999/xhtml’>[/code]

The very 1st three lines of ‘functions.php’

[code=php]<?php
function Check_Search(){
session_start();
[/code]

I am in no doubt of my blind ignorance, but could someone point out why i get:
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/content/83/9339983/html/index2.html:1) in /home/content/83/9339983/html/index2.html on line 1

My last version of the site was index.php, not html…
But all the rest of php code runs fine in it… just session_start

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@chrisranjanaJun 11.2012 — There might be a newline character present at the end of functions.php file. Try not closing the PHP tag in functions.php. Also is index2.html same as index.html ?
Copy linkTweet thisAlerts:
@NogDogJun 11.2012 — Or just move the session_start(): line to be the very first command in the included file.
Copy linkTweet thisAlerts:
@PlecPickerauthorJun 11.2012 — It is the 1st lines..

if i set the 1st line of index2.html to:
[code=php]<?php require "phpinclude/functions.php"; Check_Search();?>[/code]

And the 1st line of functions.php to:
[code=php]<?php function Check_Search(){ session_start();[/code]

I get the error, the closing tag in functions.php makes no difference.

Also

if i set the 1st line of index2.html to:
[code=php]<?php session_start(); require "phpinclude/functions.php"; Check_Search();?>[/code]

And the 1st line of functions.php to:
[code=php]<?php function Check_Search(){ [/code]

I get pretty much the same error.

the code is different fro the old site version, but simple, i cannot see why.

The only difference i can see is it is now index2.html not index.php.

but the php runs fine in it...


Could it be because i have a main page for my domain that uses sessions, and this page is in the same directory just named differently?

I'm not running index.php, but it is there in the same directory...
Copy linkTweet thisAlerts:
@svidgenJun 11.2012 — What editor or IDE are you using? (I suspect a BOM.)
Copy linkTweet thisAlerts:
@PlecPickerauthorJun 11.2012 — I'm using notepad++

index2.html is set to 'encode in UTF-8'

functions.php is set 'encode in ANSI'

There is an option for 'encode in UTF-8 without BOM'

I have little idea what these do...
Copy linkTweet thisAlerts:
@svidgenJun 11.2012 — Yep. Set to encode in UTF-8 without the BOM.
Copy linkTweet thisAlerts:
@PlecPickerauthorJun 11.2012 — Nice one.

Thanks mate. ?
Copy linkTweet thisAlerts:
@NogDogJun 11.2012 — Ah...I didn't see (i.e. look closely enough) that the session_start() was part of the function definition. Glad you got it sussed.
×

Success!

Help @PlecPicker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...