Cannot modify header information - headers already sent #40

Open
smith981 opened this Issue Jan 26, 2016 · 4 comments

Projects

None yet

4 participants

@smith981

When running index.php using php -s on OS/X El Capitan, I get

Whoops \ Exception \ ErrorException (E_WARNING)
Cannot modify header information - headers already sent by (output started at /Users/anon/Desktop/CrudKit2/vendor/skyronic/crudkit/src/CrudKit/Pages/BasicLoginPage.php:67)

This code block is then shown with the header("Location..." line highlighted:

    /**
     * Render your CrudKit app and output to HTML
     */
    public function render () {
        $content = $this->renderToString();

        if ($this->redirect !== null) {
            header("Location: ".$this->redirect);
            session_write_close();
            exit();
@smith981
smith981 commented Feb 2, 2016

This only appears on my OS/X installation. It's fine on Windows.

@Lucbug
Lucbug commented Feb 9, 2016

Experienced the same issue on OSX.

I solved it by exiting the php -S command and moving the project folder to my htdocs. It was then running smooth with XAMPP.

@genofire

Not a Mac issue. (i put it on a hoster and i got this error).

(On my php -S it works well :()
Current workarround: disable login and use .htaccess

@nzjs
nzjs commented Oct 15, 2016

Resolved this by adding ob_start(); to the beginning of my index.php file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment