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.
I don't think you read the article entirely. Disabling secure boot is temporary. Once the install is complete it seems to be fine?
It's not a solution, it's a workaround that maintains the security options after the installation is complete.
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