Wednesday, 9 August 2017

PHP header location-redirect doesn't work - why?





Here's my file. I want to make it redirect, but nothing happens. To check out what is going on, I added an echo before the header part.



It neither throws an error or redirect to index.php. What is wrong?
I have turned output buffering on/off, but nothing makes it redirect. What can I do?




error_reporting(E_ALL);
echo 'This is an error';

header("Location: login.php");
die();
?>


Thanks


Answer




I reminded myself that I had xDebug installed on the actual test environment and after googling it, I found this site: http://bugs.xdebug.org/view.php?id=532



So I'll downloaded the last version of xDebug and changed the php.ini accordingly for the new file and everything works out like a charm. Headers are being sent - the redirecetion is done and errors are displayed.



Thanks everybody for your help!


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...