Page 1 of 1

Please Help!!

Posted: Fri Sep 13, 2002 5:57 pm
by veneerz
Hello,
My programmer is on vacation and this mourning I woke up and our shop is giving this error.

Warning: Cannot send session cookie - headers already sent by (output started at /home/www/veneerz/setup.php:1032) in /home/www/veneerz/shop.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output started at /home/www/veneerz/setup.php:1032) in /home/www/veneerz/shop.php on line 4

Our server recently switched to PHP 4.2.2 and the site was written for an older version 4.0.1 I think. May this be a reason for a conflict?
Please if anyone knows head me in the right direction to where to look for an error. I am not a PHP expert but I am a fast learner and almost sure that can fix this bug if at least know what exactly causes it.
Here are the 4 lines from shop.php:

<?php
include("setup.php");

session_cache_limiter('private');

session_start();

Posted: Fri Sep 13, 2002 6:11 pm
by DSM
session_start(); needs to be at the very top

Code: Select all

&lt;?php
session_start();
include("setup.php"); 
session_cache_limiter('private'); 
?&gt;

Posted: Fri Sep 13, 2002 6:31 pm
by veneerz
Thank you DSM.
I changed the order. but now a new error comes up:

Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition cart_items of the object you are trying to operate on was loaded _before_ the session was started in /home/www/veneerz/setup.php on line 465

8O

Posted: Fri Sep 13, 2002 8:53 pm
by DSM
hmm, it obviously has to have the set.php included before the session starts, but you cannot start a session after HTML has been output to the browser.

Posted: Sat Sep 14, 2002 12:58 am
by Takuma
Change the order to

Code: Select all

&lt;?php
include("setup.php");  
session_start(); 
session_cache_limiter('private');  
?&gt;

Posted: Sat Sep 14, 2002 1:59 am
by veneerz
When UI chenged the order again, here is how the error come up:

Warning: Cannot send session cookie - headers already sent by (output started at /home/www/veneerz/setup.php:1032) in /home/www/veneerz/shop.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output started at /home/www/veneerz/setup.php:1032) in /home/www/veneerz/shop.php on line 4

I am lost an in the dark. This is really getting depressing. On Monday we most likely will get fired. Please let me know how to fix this bug. Bogdan will only come back on Wednesday, but our boss will be back on Monday and would like to see how all of our sites are doing. There is no way I can contact Bogdan.... his butt is partying in Florida. I hope this tropical storm will rip off the roof of his bungalow while he's sleeping.
The only language I know is ActionScript, for gods sake, I am only a designer!
I will pay for this forum's next 3 month server bill, just please help me fix this before Monday 9am EST. I am really back against the ropes here.

Art
Still brathing for now.

Posted: Sat Sep 14, 2002 2:06 am
by dusty
check out the first sticky..

Code: Select all

&lt;?
ob_start();
include("setup.php");   
session_start();  
session_cache_limiter('private');   
ob_end_flush();
?&gt;

Posted: Sat Sep 14, 2002 2:18 am
by veneerz
It worked, it worked!!!!!!!!!!
I love you dusty!!!!
And the rest of you guys, you were really helpful!!!!!
Is there a way to donate to this forum?????
Place like this should really be kept sacred and cared for. I had never seen support like this even from our web hosts!!!!
I really want to do something nice for you guys.
If anyone wants a dash kit, I will get it for them for 30% off our prices that is what our company pays for them.

Posted: Sat Sep 14, 2002 2:20 am
by dusty
i don't have a forum but you can pay my bills :D

Posted: Sat Sep 14, 2002 2:42 am
by veneerz
dusty, can you run a forum???
I can supply great audience.....
It will be an automotive forum and if we run it properly, advertisements can be really rewarding...

Posted: Sat Sep 14, 2002 5:08 am
by Takuma
Anyone can run a forum try phpBB or vBulletin!

So what does ob_start do?

Posted: Sat Sep 14, 2002 8:53 am
by MattF
It starts output buffering so that anything echo'ed is not echo'ed but is saved temporarily until output buffering is stopped. The only concern I have is that there may be some error occuring that was being echo'ed above session start and now this is hidden so something may not be working right without you knowing. On the other hand it could just be a warning or something.

Posted: Sat Sep 14, 2002 11:57 am
by veneerz
Hey guys,
There is one problem with ob_start ();
It flushes the session if you go to a different page. For example, if someone put an item in the basket and then decides to browse some more before submiting and order and leaves the shop.php page session is flushed and when he/she comes back to check out the item is gone from the basket......
But I guess I can live with this for a couple of days.

Posted: Sat Sep 14, 2002 12:09 pm
by Takuma
Well what is in setup.php anyway?

Posted: Sat Sep 14, 2002 12:13 pm
by veneerz
You want me to post an entire 40k file?