PHP Force Apache error
Thanks to this forum, I learnt PHP header function does not actually send header to Apache server but only to th开发者_如何学Goe client.
What I wanna do is to generate an error 500, and let Apache displays its corresponding page. Is there a way to force it ?
Thanks in advance ! (and allez les bleus !)
There's a way of sending a 500 Error to the browser, but you'll have to provide the page yourself:
<?php
header('HTTP/1.1 500 Internal Server Error');
echo <<<ERRORTEXT
The server encountered an unexpected condition which prevented it
from fulfilling the request.
ERRORTEXT;
// also notify server operator, maybe?
exit;
?>
Do a redirect to a URL that causes a 500.
For example a url with an invalid .htaccess directive.
Just do a broken cgi script:
// Don't include stdio
int main() {
printf("This won't work.\n");
return 0;
}
精彩评论