Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Created July 1, 2022 19:41
Show Gist options
  • Save alphaolomi/a9434636850e5cf4a1ac9a177cc1c0f0 to your computer and use it in GitHub Desktop.
Save alphaolomi/a9434636850e5cf4a1ac9a177cc1c0f0 to your computer and use it in GitHub Desktop.
Check all required PHP extension for Laravel
<?php
// OpenSSL PHP Extension
// PDO PHP Extension
// Mbstring PHP Extension
// Tokenizer PHP Extension
// XML PHP Extension
// SQLite PHP Extension (for SQLite3 support)
$extensionsList = [
'openssl',
'pdo',
'mbstring',
'tokenizer',
'xml',
'sqlite',
];
echo "\n\nChecking PHP Extensions...\n" . PHP_EOL;
foreach ($extensionsList as $extension) {
// Check if the extension is loaded
if (extension_loaded($extension)) {
echo "\033[32m" . $extension . " is loaded\033[0m\n";
} else {
echo "\033[31m" . $extension . " is not loaded\033[0m\n";
}
}
// For linux: To install Use `sudo apt install openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment