Created
August 4, 2025 14:55
-
-
Save TheAndrey/974be40f64fd1c92beddb711a3f9878f to your computer and use it in GitHub Desktop.
PHP environment check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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