zero-perfoliate
zero-perfoliate

Author Topic: Multi-language script header problem  (Read 428 times)

Offline tuurismo

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
Multi-language script header problem
« on: April 22, 2010, 12:09:38 PM »
Hi,

I am having a major problem with my php coding on my site. I'm trying to implement a multi language script. The script can be found and is explained here.

Problem is that I get a "headers already sent error", caused by the setcookie and session_start(); function. I have tried everything by moving these functions to make sure they come first on the page. There's no whitespace before the functions and I'm left wondering why it doesn't work.

Code: [Select]
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php:1) in /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php:1) in /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php:1) in /opt/www/mashamotoltd2/web/www.mashamoto-imports.com/index.php on line 3

Weird thing is that the script works perfectly on other pages. I copied the exact same code from index.php and created index2.php Exactly the same scripting used as on index.php!! Why does it work here and not on on the normal index.php?

The script is also installed on http://www.mashamoto-imports.com/cars-for-sale.php Here it also works fine and the setcookie also works as you can see.

I really hope someone can help me out as I need to get this to work asap.

Offline [uk]stuff

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Multi-language script header problem
« Reply #1 on: April 22, 2010, 01:57:51 PM »
You need to make sure that nothing is echo'd out between the top of the script and the header function. This includes any whitespace you may have at the top of the script before the opening <? or <?php

Failing that could you post the file you have problem with so I can have a look?

 

zero-perfoliate