I am facing this ugly error on header of my website, how I can remove it. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/eitlabs1/public_html/salmanoreen.com/index.php:1) in /home/eitlabs1/public_html/salmanoreen.com/libraries/joomla/session/session.php on line 423 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/eitlabs1/public_html/salmanoreen.com/index.php:1) in /home/eitlabs1/public_html/salmanoreen.com/libraries/joomla/session/session.php on line 423 Warning: Cannot modify header information - headers already sent by (output started at /home/eitlabs1/public_html/salmanoreen.com/index.php:1) in
The error means that somewhere in the code, something was printed to the browser before Joomla (according to the file path) had finished preparing the page. This is most often caused by custom or modified code contributed from sources outside Joomla, so inspect your uniquely added code (including themes) first... Check if you have added any print or echo command BEFORE the header is called : echo "blah blah"; header('Location: http://www.example.com/'); PHP: To solve : function JavaScriptRedirect($redirect_url) { ?> <script type="text/javascript"> window.location = "<?=$redirect_url;?>" </script> <? } echo "blah blah"; JavaScriptRedirect("http://www.example.com/"); PHP:
I'd just stick this at the very top of my file - always works. ob_start(); Code (markup): Example: <?php ob_start(); ?> PHP:
I disagree with ob_start();. This is basically a bandaid for poor coding. You fundamentally shouldn't be outputting anything before the headers and cookies are set. Find what is outputting to the browser and correct it.
I found the above mentioned problem. it was problem in index.php there was a malware script before php code starts, when I removed that script my problem get resolved. I had same problem with all of my websites which are hosted on same server, it means my hosting get some hack attack and someone put some script injection to all of my websites. and when such script get removed websites get errors free.
but I am unable to login in backend. here I am sharing one of my admin login page, kindly let me know from where I can manage it. I am facing such errors. error_reporting(0) Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/eitlabs1/public_html/salmanoreen.com/administrator/index.php:2) in /home/eitlabs1/public_html/salmanoreen.com/libraries/joomla/session/session.php on line 423 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/eitlabs1/public_html/salmanoreen.com/administrator/index.php:2) in /home/eitlabs1/public_html/salmanoreen.com/libraries/joomla/session/session.php on line 423 Warning: Cannot modify header information - headers already sent by (output started at /home/eitlabs1/public_html/salmanoreen.com/administrator/index.php:2) in /home/eitlabs1/public_html/salmanoreen.com/libraries/joomla/session/session.php on line 426
I agree that it isn't the best thing - but as a quick fix it's good enough for me. (Am known for my messy coding - but my theory is, as lo0ng as it works, that's all that matters)