I wrote it on my PC using WAMP to test it. I then wanted to move it about and show a friend so i copied the files over to my memory stick which has XAMPP on it.
When i run the script in XAMPP i get this error
Warning: Cannot modify header information - headers already sent by (output started at M:\PC Tools\Portable Apps\Server\xampplite\htdocs\cinema-database\admin\index.php:8) in M:\PC Tools\Portable Apps\Server\xampplite\htdocs\cinema-database\functions.php on line 80
I've done some searching and it seems to be because im setting the header after ive output stuff (as the warning tells me :p), the problem is, even when i move the header() call to the top of the page, before any output, i get no warning output, but the code also doesnt work.
Here is the code its having problems with.
78 | //if the cookie does not exist, they are taken to the login screen
79 | {
80 | header("Location: http://" . $_SERVER['SERVER_NAME'] . "/cinema-database/admin/login.php?msg=2");
81 | }
I have seen solutions saying use ob_start(), but doing this doesnt seem to make a difference.
Nothing is stopping you from continuing with your testing cadence.
If updates are released every 2 weeks instead of 4, and you test once every 4 weeks, the exact same amount of patches will still be available for you in those 4 weeks.
For example:
Before
4th week - patch 1, 2, 3, 4
After
2nd week - patch 1 and 2
4th week - patch 3 and 4
Still the same amount after 4.
Everyone else has said it. I'm gonna say it - you don't know what you're talking about.
I do. I have two laptops. One work, one personal. I have access to two more laptops - both personal. At home I manually update my personal laptop when I see on Neowin that there is an update - I carry on and only apply the updates when I am ready. My work one only updates when my workplace decides to send it - I carry on and only apply the updates (when they actually arrive, which is usually days after the release) when I switch off the laptop at the end of the day as usual. The two other personal laptops only get updated when I get to it which is rarely - the people who own them carry on using them until I get to it and update them.
All of the browsers on all laptops are configured to restore the tabs when launched.
Google and Microsoft have changed from 6 weeks to 4, and it looks like it's going to move to 2. None of these changes affect how any of these browsers on the laptops are used. Not one jot.
My advice to you is stop panicking whenever you see an update. Just carry on with what you're doing. This even benefits you in a way - from your comment you sound like you don't like the changes or the frivolous new features - great - then carry on as before!
Question
mikeaag
hey all,
Got a problem with some code ive written.
I wrote it on my PC using WAMP to test it. I then wanted to move it about and show a friend so i copied the files over to my memory stick which has XAMPP on it.
When i run the script in XAMPP i get this error
Warning: Cannot modify header information - headers already sent by (output started at M:\PC Tools\Portable Apps\Server\xampplite\htdocs\cinema-database\admin\index.php:8) in M:\PC Tools\Portable Apps\Server\xampplite\htdocs\cinema-database\functions.php on line 80
I've done some searching and it seems to be because im setting the header after ive output stuff (as the warning tells me :p), the problem is, even when i move the header() call to the top of the page, before any output, i get no warning output, but the code also doesnt work.
Here is the code its having problems with.
78 | //if the cookie does not exist, they are taken to the login screen 79 | { 80 | header("Location: http://" . $_SERVER['SERVER_NAME'] . "/cinema-database/admin/login.php?msg=2"); 81 | }I have seen solutions saying use ob_start(), but doing this doesnt seem to make a difference.
Any suggestions?
Thanks in advance
Link to comment
https://www.neowin.net/forum/topic/848292-php-cannot-modify-header-information/Share on other sites
7 answers to this question
Recommended Posts