Welcome Guest, Not a member yet? Register   Sign In
"Headers already sent" after uploading to website to server
#1

[eluser]toki[/eluser]
Hi,

i developed a codeigniter website on my local server (apache, ubuntu). It works fine.
Now i uploaded it to my webserver. I get the error "Cannot modify header information - headers already sent by"

I understand that this error occurs when some output is printed and a redirect is done afterwards. But how can there be a difference depending on the server the site is hosted on?

And what is the best whay to find the source of the error?

Thanks for your help in advance!

Toki
#2

[eluser]Bart v B[/eluser]
Show some code where it happens..

Do you use the closing php tag?
( ?> )

that could be the problem.
#3

[eluser]toki[/eluser]
I am using that closing tag. What would be the alternative?

"Code where it happens" - that's what I am looking for ;-)

The message:

Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/projektexplorer.de/system/helpers/tki_helper.php:21)

Filename: libraries/Session.php

Line Number: 662

1 2 3 >  Last ›

The tki_helper.php contains

Code:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

if ( ! function_exists('nvl'))
{
    function nvl($val, $alternative) {
            if (isset($val) && trim($val) != "")
                return $val;
            else
                return $alternative;
        }
}


?>
#4

[eluser]WanWizard[/eluser]
So what's on line 21 of that file? A space or new line after the closing tag?

As the CI coding standards state: do NOT use a closing tag in your files. This make sure you don't get these errors...
#5

[eluser]InsiteFX[/eluser]
If you use the <?php tag you do not need the ending ?> tag.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB