Skip to content

Instantly share code, notes, and snippets.

@TheAndrey
Created August 4, 2025 14:55
Show Gist options
  • Select an option

  • Save TheAndrey/974be40f64fd1c92beddb711a3f9878f to your computer and use it in GitHub Desktop.

Select an option

Save TheAndrey/974be40f64fd1c92beddb711a3f9878f to your computer and use it in GitHub Desktop.
PHP environment check
#!/usr/bin/env php
<?php
echo "=== PHP Environment Check ===\n\n";
// PHP version and system info
echo "PHP Version : " . PHP_VERSION . "\n";
echo "PHP SAPI : " . PHP_SAPI . "\n";
echo "OS : " . PHP_OS_FAMILY . " / " . PHP_OS . "\n";
echo "Loaded php.ini : " . php_ini_loaded_file() . "\n\n";
// Recommended extensions to check
$extensions = [
'opcache',
'json',
'curl',
'openssl',
'xml',
'fileinfo',
'exif',
'gd',
'zip',
'bcmath',
'mbstring',
'intl',
'redis',
'memcached',
'apcu',
'pdo',
'pdo_mysql',
'mysqli',
'sqlite3',
'pdo_sqlite',
'pcntl',
'posix',
'xdebug'
];
echo "Checking extensions:\n";
foreach ($extensions as $ext) {
if (extension_loaded($ext)) {
echo " [✓] $ext\n";
} else {
echo " [✗] $ext\n";
}
}
// Available locales
echo "\nAvailable system locales:\n";
$locales = shell_exec('locale -a 2>/dev/null');
if ($locales) {
$localeList = explode("\n", trim($locales));
foreach ($localeList as $locale) {
echo " - $locale\n";
}
} else {
echo "Could not retrieve locales. Is `locale` command available?\n";
}
echo "\nDone.\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment