<?php
header('Content-Type: text/plain; charset=utf-8');

echo "=== PHP上传配置检查 ===\n\n";
echo "upload_max_filesize: " . ini_get('upload_max_filesize') . "\n";
echo "post_max_size: " . ini_get('post_max_size') . "\n";
echo "max_file_uploads: " . ini_get('max_file_uploads') . "\n";
echo "max_execution_time: " . ini_get('max_execution_time') . "\n";
echo "memory_limit: " . ini_get('memory_limit') . "\n";
echo "upload_tmp_dir: " . (ini_get('upload_tmp_dir') ?: '系统默认') . "\n";

echo "\n=== 视频目录权限 ===\n";
$dirs = ['videos/', 'videos/opening/', 'videos/host/'];
foreach ($dirs as $dir) {
    $path = __DIR__ . '/' . $dir;
    $exists = is_dir($path) ? '存在' : '不存在';
    $writable = is_writable($path) ? '可写' : '不可写';
    echo "$dir: $exists | $writable\n";
}

echo "\n=== 错误日志最后10行 ===\n";
$logFile = __DIR__ . '/logs/upload_errors.log';
if (file_exists($logFile)) {
    $lines = file($logFile);
    $lastLines = array_slice($lines, -10);
    foreach ($lastLines as $line) {
        echo $line;
    }
} else {
    echo "日志文件不存在\n";
}
