Welcome Guest, Not a member yet? Register   Sign In
404 shows a blank page
#11

[eluser]gRoberts[/eluser]
Any idea's anyone?

It seems to be related to my web host as I have now got two CI projects running on the same host with the same issue.

Cheers

Gav
#12

[eluser]emily87[/eluser]
Could be to do with your .htaccess file if you're using one.

What happens if you remove/comment out
Code:
<?php header("HTTP/1.1 404 Not Found"); ?>
at the top of the error_404.php file in the application/errors folder?
#13

[eluser]gRoberts[/eluser]
I'm using the stock .htaccess file as suggested by the user guide (http://ellislab.com/codeigniter/user-gui.../urls.html)

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

As for the error_404.php file, it does not contain that code.

Just FYI, I'm running 1.7.2.

My show_404 code:
Code:
function show_404($page = '')
    {    
        $heading = "404 Page Not Found";
        $message = "The page you requested was not found.";

        log_message('error', '404 Page Not Found --> '.$page);
        echo $this->show_error($heading, $message, 'error_404', 404);
        exit;
    }

show_error:
Code:
function show_error($heading, $message, $template = 'error_general', $status_code = 500)
    {
        set_status_header($status_code);
        
        $message = '<p>'.implode('</p><p>', ( ! is_array($message)) ? array($message) : $message).'</p>';

        if (ob_get_level() > $this->ob_level + 1)
        {
            ob_end_flush();    
        }
        ob_start();
        include(APPPATH.'errors/'.$template.EXT);
        $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }

The first line of show_error seems to be causing the error. If I place a die before set_status_header($status_code); it will throw an error that i am outputting before headers have been sent and then show my 404 page below.

Also, FYI, i haven't changed any of the system files or any of the error pages.

Cheers

Gavin
#14

[eluser]gRoberts[/eluser]
I take it no one knows why this is happening?

By commenting out set_status_header it works. But this won't send correct 404 headers.

Any idea's?

Cheers

Gavin
#15

[eluser]ciKD[/eluser]
I ran into a similar problem with 1.7.2 and tests to customize db-error-output, no solution found so far, might be same reason? [SOLVED, was different reason, see posting]

Posting: As soon as I add header(‘Content-Type: application/x-json; charset=utf-8’); nothing seems to be sent

As a sidenote, in Exceptions.php, why is $heading not used at all in function show_error($heading, $message, $template = 'error_general', $status_code = 500) ? [SOLVED, of course it is used, in include().. ]




Theme © iAndrew 2016 - Forum software by © MyBB