mjsulliv Posted July 20, 2010 Share Posted July 20, 2010 In my ongoing but scattered learning / work on web programming I’ve more than once encountered a “header” problem. In the most recent occurrence I found something interesting as described below. I have a php file called from another page via “onclick="location.href=…”. The called page uses a “session_start()” call to get access to global variables. When the enclosing “<?php “ is NOT on the very first line of the file I get: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent… But if it is on the first line there is no error. I’d love to know why this is. Any thoughts would be appreciated. Link to comment Share on other sites More sharing options...
thescientist Posted July 20, 2010 Share Posted July 20, 2010 it means something is sending something to the web browser before your PHP starts. this can include whitespace. so make sure the opening <?php is the very first line. Link to comment Share on other sites More sharing options...
HungryMind Posted July 20, 2010 Share Posted July 20, 2010 Hi!I Think You Are Using session_start(); In Your Page Multiple Times, Check Out First...If Not... Then Add These Codes:<?php ob_start(); ?> session_start(); // Be Sure That You Are Using session_start(); 1 Time In 1 One.?>Your All CODE<?php ob_flush();?>OR<?php ob_start(); ?> session_start(); // Be Sure That You Are Using session_start(); 1 Time In 1 One. //Your All CODE ob_flush();?> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 20, 2010 Share Posted July 20, 2010 There's a description about what causes that error and how to solve it here:http://w3schools.invisionzone.com/index.php?showtopic=12509 Link to comment Share on other sites More sharing options...
mjsulliv Posted July 20, 2010 Author Share Posted July 20, 2010 http://w3schools.invisionzone.com/index.php?showtopic=12509Yes! A great explanation of what's going on in my code; though "headers" themselves are still fuzzy.Thanks --- MikeBTW I like your reference / link to Babbage. From my history of science classes in college I remember his concern about human "transcription" being one of the biggest problems in information handling; thus his construction of a printing device for mechanical calculators. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 20, 2010 Share Posted July 20, 2010 Indeed. He correctly assumed that humans would be the greatest source of errors in computers. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.