I have just write a two line code in PHP (to test that way my "header" are not working on several pages) which is as follows: <?PHP header('location:welcome.php'); // This is line 2 exit; ?> PHP: This code is working fine & this script redirecting me to "welcome.php" on my localhost (my computer) but when I upload same code to my web sever I am getting following warning: Warning: Cannot modify header information - headers already sent by (output started at /home/myhostname/public_html/website.com/test/test.php:1) in /home/hostname/public_html/website.com/test/test.php on line 2 I have another web server & on that server this same script working fine too. So, I come to conclusion that I need to make some changes in my "ini" file so that sever can ignore all these type of warnings, but I donot know that which parameter(s) I need to change & how I can change it(them) on server. Another solution is that I improve my script so that it does not generate such warnings, again I donot know how I can write such script which does not generate such warnings. Please send me any solution to solve this problem. Any help will be appreciated. Thanks, Akash
Hello, Thanks for reply.... There are no white spaces in code. same code is working perfectly on my localhost & a web server as well, but its not working the web server where I want to run it. (I have two web server accounts with two different companies for two different websites) I know I need to make changes in "ini" file so that server just ignore this warning... (as my one server & localhost are doing...), but I don't know where to make change in "ini" file. If have any idea please help. I am trying to solve this problem last many hours. Thanks once again,
This kind of problem occurs when any empty space occurs before the starting of <?php ?> tag, or any html tag ( ie generating output) occurs before <?php header();?>
Something is written to the header before the location redirect. Be sure to get rid of all chars written to the browser. Also, try using a header script with a full address "http://www.blaa".