LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   having problem in porting php4 code to php5 in sessions (https://www.linuxquestions.org/questions/programming-9/having-problem-in-porting-php4-code-to-php5-in-sessions-544719/)

mohtasham1983 04-10-2007 01:11 AM

having problem in porting php4 code to php5 in sessions
 
Hi folks,
I had designed a website using PHP last year on my fedora core 4 machine and it was working smoothly. I have not been working on PHP since that time, therefore when I was going to make my website running on my ubuntu edgy machine which runs PHP 5, I am getting the following error:

Code:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/html/index.php:14) in
Any idea?

graemef 04-10-2007 01:47 AM

Well what do you have on line 14 of index.php?
And where do you have the call to session_start() (after line 14 I'd wager)

This is only a warning so the code should still work. (at least I don't think this would be a show stopper)

You probably have this error appearing on the PHP4 code but you're probably not displaying the error, check the error logs.

mohtasham1983 04-10-2007 02:39 AM

actually I placed session_start() at the beginning of each file, so I don't see that warning anymore in my page. Thanks for reply

graemef 04-10-2007 02:56 AM

Okay, but...there are a couple of cases where that will not work for you:

1) When one file includes another (the session start will already have been started and causes another warning when you try and start it a second time)

2) When you add an object to the session, because the object's class must be declared (include'd) before the session has been started. So class include files must come before session start.


All times are GMT -5. The time now is 04:34 AM.