Skip to content

Instantly share code, notes, and snippets.

@meigwilym
Created April 5, 2018 13:20
Show Gist options
  • Save meigwilym/c08bd4ac0fdca7be49c57ff545e2235d to your computer and use it in GitHub Desktop.
Save meigwilym/c08bd4ac0fdca7be49c57ff545e2235d to your computer and use it in GitHub Desktop.
A PHP file that checks that your server is compatible with Laravel 5.6's requirements.
<?php
$phpversionok = false;
if(PHP_VERSION_ID >= 70103) {
$phpversionok = true;
}
$exts = ['openssl', 'pdo', 'mbstring', 'tokenizer', 'xml', 'ctype', 'json'];
$extsNotloaded = [];
foreach($exts as $i => $extension) {
if(!extension_loaded($extension)) {
$extsNotloaded[] = $extension;
unset($exts[$i]);
}
}
?>
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel 5.6 Compatability Check</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-size:1.2em;
height: 100vh;
margin: 0;
}
p{
color:black;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
Laravel 5.6 Compatibility Check
</div>
<div>
<?php if($phpversionok): ?>
<p>&check; The PHP version is good: <?php echo phpversion(); ?></p>
<?php else: ?>
<p>&cross; The PHP version is not compatible: <?php echo phpversion(); ?></p>
<?php endif; ?>
<?php if(count($extsNotloaded) > 0): ?>
<p>These PHP modules are needed: </p>
<ul>
<?php foreach($extsNotloaded as $ext): ?>
<li><?php echo $ext; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(count($exts) > 0): ?>
<p>These PHP modules are OK: </p>
<ul>
<?php foreach($exts as $ext): ?>
<li><?php echo $ext; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment