views:

21

answers:

2

hey there!

I have a project running on dreamhost hosting and it's working fine, but since DH has been getting really slow I'm moving the project to my new dedicated server.

The thing is that after I move all of my file over to the new dedicated (ubuntu 8.4) I get see warnings all over the place telling me that the headers had been already sent.

The first thing I tried was moving the files via FTP: download to my machine, upload to server - Didn't worked

Second try was tar.gz the folder on the first server and untar it on the new one, didn't worked either

I tried chaing enconding to ANSI and they start working, however most of my files contain accents so ANSI is not an option for all my files i need UTF8

Any ideas on how to fix this? I'm sure it must be some sort of config

+1  A: 

Check for a space for new line character after closing ?> on any of the files.

Also, the warning that you speak of actually tells you the file and line that the output started at so it gives you a place to start looking...

ircmaxell
I know, it tells me the output is being generated at line 1, I've had this issued before and learned to place session_create() at the very begining of the file with no spaces, what about the files in which I have both HTML and PHP?
PERR0_HUNTER
Then you have a space or something before the opening `<?php`. The only ways around that are either to always put `<?php` at the start of the first line, or enable output buffering in php.ini: http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering
ircmaxell
+2  A: 
  1. If changing from utf-8 to 'ansi' makes it work, you have an UTF8-BOM in your files: remove them, either by using a hex editor (lots of work), or by using an editor which understands (or can be configured) not to put the utf8-BOM there. You normally wouldn't see these characters in an editor, so effectively it seems there's no output before the <?php. See: http://en.wikipedia.org/wiki/Byte_order_mark
  2. As a temporary fix you can set the output_buffering setting to On in .htaccess / php.ini to always buffer untill you've fixed all the files.
Wrikken
output_buffering = 4096 was something I copied from DH's php.ini to my server and the errors whent away, is this a good practice?
PERR0_HUNTER
Well, it can work, see http://nl.php.net/manual/en/outcontrol.configuration.php It can have some performance issues though. If your files are back up to code I'd recommend turning them off again (and not to display_errors but log them to prevent an error message from fouling headers up).
Wrikken