Skip to content

Instantly share code, notes, and snippets.

@mcejp
Created September 14, 2023 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcejp/a27e3fe3648a114d2959d387d781f991 to your computer and use it in GitHub Desktop.
Save mcejp/a27e3fe3648a114d2959d387d781f991 to your computer and use it in GitHub Desktop.
BSOD-style error page in PHP
<!doctype html>
<html>
<head>
<style>
html {
font-size: 1.2em;
}
body {
background: #0000aa;
color: #aaaaaa;
font-family: courier, monospace;
}
h1 {
display: inline-block;
padding: 0em 1ch;
margin: 0 auto;
font-size: 1rem;
font-weight: normal;
background: #aaaaaa;
color: #0000aa;
}
p {
margin: 2em 0;
text-align: left;
}
a, a:hover {
color: inherit;
font: inherit;
}
blink {
color: yellow;
-webkit-animation: blink 1s steps(1, end) infinite;
animation: blink 1s steps(1, end) infinite;
}
@-webkit-keyframes blink {
80% {
opacity: 0;
}
}
@keyframes blink {
80% {
opacity: 0;
}
}
ul {
list-style: none;
}
ul li::before {
content: '*';
position: absolute;
left: 1em;
}
.preformatted {
white-space: pre;
}
.bg-dkgray { background-color: #555555; }
.c-white { color: #ffffff; }
</style>
</head>
<body>
<!-- From http://www.catswhocode.com/blog/how-to-create-a-bsod-like-404-page -->
<h1>Application Error</h1>
<p>Exception <span class="c-white"><?= htmlspecialchars(get_class($exception), ENT_QUOTES) ?></span> has occured. Message:</p>
<p><span class="c-white preformatted"><?= htmlentities($exception->getMessage(), ENT_QUOTES) ?></span></p>
<p>in <span class=""><?= $exception->getFile() . ':' . $exception->getLine() ?></span></p>
<p>Stack trace:</p>
<ul>
<?php
foreach (explode("\n", $exception->getTraceAsString()) as $line) {
?>
<li><?= $line ?></li>
<?php
}
?>
</ul>
<p>
Press any key to restart your computer <blink>_</blink>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment