Afternoon ladies & gents, We've installed a mobile version of our website. The main website and the mobile version redirect are working flawlessly, but it has caused the following error to appear in the header; Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\vhosts\stowfordmanorfarm.co.uk\httpdocs\index.php:1) in C:\Inetpub\vhosts\stowfordmanorfarm.co.uk\httpdocs\concrete\startup\session.php on line 32 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\vhosts\stowfordmanorfarm.co.uk\httpdocs\index.php:1) in C:\Inetpub\vhosts\stowfordmanorfarm.co.uk\httpdocs\concrete\startup\session.php on line 32 Code (markup): Naturally, I've ensured the site is working perfectly .. so now I'd like to simply hide these errors from publicly displaying in the header. Can somebody assist? Website: http://stowfordmanorfarm.co.uk/ Code (markup): WebDev
You have started / used session_start() without checking if session is already present. Amend your code (probably in the sessions.php-file) to something like if (!session_id()) { session_start(); } PHP: And no, your site is not "working flawlessly" when you have an error showing up.
Or you have a UTF-BOM at the start of your script.. that outputs some bytes to the browser so sessions can't be started...
Or even just something as simple as a carriage return before your first <? Remember, ANY content output before you try to start the session means headers are already sent! There's a reason when writing PHP I prefer to have only oneand ONLY ONE <?php per FILE and have it the VERY first thing in said file.... instead of the willy-nilly <?php ?><?php ?><?php ?><?php ?><?php ?><?php ?><?php ?><?php ?><?php ?><?php ?><?php ?> You see in people's code that they are under the delusion is good practice. In your case it looks like you are sending this: <script src="redirect.js"></script> <script> SA.redirection_mobile ({ noredirection_param:"full", //tablet_redirection : "true", mobile_url : "m.stowfordmanorfarm.co.uk", mobile_prefix : "http", cookie_hours : "1" }); </script> Code (markup): Before you've even sent the doctype! Script doesn't go there!!! Suppressing the error is not a fix, NOR is it a "false positive" -- that's proof positive that there's something disastrously wrong with your PHP.
Well... he's also using a mobile-subdomain, which I was hoping was going the way of the dodo at least 5 years ago. There is not really any reason to use a mobile subdomain unless you have completely different content for mobile and desktop (which few have) - and even then that can usually be solved with smart programming of the site.
Which really is something that never should have existed in the first place -- see the nonsense of WAP and/or WML; the entire POINT of HTML was to be device neutral, it's just most people couldn't pull their heads out of photoshop jockey's ass to realize it. The scripttard redirect for mobile, subdomains just for mobile, it all completely misses the entire reason HTML even exists. ... as does it seem most people building websites these days. So yeah, it should have faced extinction the moment responsive layout became real world deployable -- if not sooner. Of course it's also a tranny document -- and as we often say that quite literally means "in transition from 1997 to 1998 coding practices" so...