skyronic/crudkit

Cannot modify header information - headers already sent

smith981 opened this issue · 4 comments

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();

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

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.

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 commented

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