<?php
// Test Python installation
echo "<h3>Python Check:</h3>";
exec("python3 --version 2>&1", $output);
echo "<pre>" . implode("\n", $output) . "</pre>";

// Test OpenCV installation
echo "<h3>OpenCV Check:</h3>";
$testScript = 'import cv2; print(f"OpenCV version: {cv2.__version__}")';
exec('python3 -c "' . $testScript . '" 2>&1', $output);
echo "<pre>" . implode("\n", $output) . "</pre>";

// Test file permissions
echo "<h3>Directory Permissions:</h3>";
echo "<pre>";
echo "Uploads: " . substr(sprintf('%o', fileperms('uploads/')), -4) . "\n";
echo "Processed: " . substr(sprintf('%o', fileperms('processed/')), -4) . "\n";
echo "Backgrounds: " . substr(sprintf('%o', fileperms('backgrounds/')), -4) . "\n";
echo "</pre>";
?>