Welcome to the PHP Server Information Script – a robust script designed to provide valuable insights into your server environment. This script offers a overview of key aspects such as PHP memory usage, system memory details, and OS/Web Server information.
Boost productivity with the Logitech MX Master 3 – the ultimate wireless mouse with ergonomic design, seamless control, and customizable features!
View on Amazon
This script utilizes PHP functions and conditional checks to retrieve information about the operating system, PHP version, server software, and more.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <?php // Get detailed system information $systemInfo = php_uname(); echo "<b>System Information:</b><br>"; echo $systemInfo . "<br><br>"; // Get PHP version and configuration information echo "<b>PHP Information:</b><br>"; echo "PHP Version: " . phpversion() . "<br>"; echo "PHP Configuration: " . php_ini_loaded_file() . "<br><br>"; // Get server information echo "<b>Server Information:</b><br>"; echo "Server Software: " . $_SERVER['SERVER_SOFTWARE'] . "<br>"; echo "Server Name: " . $_SERVER['SERVER_NAME'] . "<br>"; echo "Server IP Address: " . $_SERVER['SERVER_ADDR'] . "<br>"; echo "Server Port: " . $_SERVER['SERVER_PORT'] . "<br><br>"; // Get more detailed server information (if available) $serverInfo = $_SERVER['SERVER_SOFTWARE']; if (stripos($serverInfo, 'apache') !== false) { // Additional Apache server information echo "<b>Apache Information:</b><br>"; $apacheInfo = apache_get_version(); echo "Apache Version: " . $apacheInfo . "<br>"; // Add more Apache-specific information if needed } elseif (stripos($serverInfo, 'nginx') !== false) { // Additional Nginx server information echo "<b>Nginx Information:</b><br>"; // Get Nginx version $nginxVersion = shell_exec('nginx -v 2>&1'); echo "Nginx Version: " . $nginxVersion . "<br>"; // Get Nginx configuration file path $nginxConfigPath = shell_exec('nginx -V 2>&1 | grep "configure arguments:"'); preg_match('/--conf-path=(\S+)/', $nginxConfigPath, $matches); echo "Nginx Config File: " . (isset($matches[1]) ? $matches[1] : "N/A") . "<br>"; } // PHP Memory Usage $phpMemoryUsage = round(memory_get_usage() / (1024 * 1024), 2); // in megabytes $phpMemoryLimit = ini_get('memory_limit'); echo "<br><b>PHP Memory Information:</b><br>"; echo "Used PHP Memory: {$phpMemoryUsage} MB<br>"; echo "PHP Memory Limit: {$phpMemoryLimit}<br><br>"; ?> |