<?php
// Function to check if a binary exists and get its path
function checkBinary($binaryName) {
$output = [];
$returnVar = 0;
// Use 'which' command on Unix-like systems or 'where' on Windows
$command = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? "where $binaryName" : "which $binaryName";
exec($command, $output, $returnVar);
if ($returnVar === 0 && !empty($output)) {
return $output[0];
}
return "Binary not found at PATH";
}
// List of binaries to check
$binaries = [
'ExifTool' => 'exiftool',
'ExifTran' => 'exiftran',
'FFmpeg' => 'ffmpeg',
'FFprobe' => 'ffprobe'
];
// Get PHP version
$phpVersion = phpversion();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binary Check</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #f4f4f4;
}
h1 {
color: #333;
text-align: center;
}
.container {
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.binary-info {
margin: 10px 0;
padding: 10px;
border-left: 4px solid #007bff;
}
.binary-info.error {
border-left-color: #dc3545;
}
.binary-info p {
margin: 5px 0;
}
.php-version {
margin-top: 20px;
padding: 10px;
background-color: #e9ecef;
border-radius: 4px;
text-align: center;
}
</style>
</head>
<body>
<h1>Binary Check Results</h1>
<div class="container">
<?php foreach ($binaries as $name => $bin): ?>
<div class="binary-info <?php echo (checkBinary($bin) === "Binary not found at PATH") ? 'error' : ''; ?>">
<p><strong><?php echo htmlspecialchars($name); ?>:</strong> <?php echo htmlspecialchars($bin); ?></p>
<p><?php echo htmlspecialchars(checkBinary($bin)); ?></p>
</div>
<?php endforeach; ?>
<div class="php-version">
<p><strong>PHP Version:</strong> <?php echo htmlspecialchars($phpVersion); ?></p>
</div>
</div>
</body>
</html>