<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "PHP Version: " . phpversion() . "\n";
echo "Current Dir: " . __DIR__ . "\n";
echo "Config File: " . realpath(__DIR__ . '/../config.php') . "\n\n";

// Intenta incluir config
try {
    require_once __DIR__ . '/../config.php';
    echo "✅ Config.php cargado OK\n";
    echo "API_KEY definida: " . (defined('API_KEY') ? 'SI' : 'NO') . "\n";
} catch (Exception $e) {
    echo "❌ Error en config.php: " . $e->getMessage() . "\n";
}

// Intenta crear log
$logDir = __DIR__ . '/../logs';
echo "\nLog Dir: $logDir\n";
echo "Existe: " . (is_dir($logDir) ? 'SI' : 'NO') . "\n";
echo "Escribible: " . (is_writable($logDir) ? 'SI' : 'NO') . "\n";

@file_put_contents($logDir . '/debug.log', "Test\n", FILE_APPEND);
echo "Pudo escribir: " . (file_exists($logDir . '/debug.log') ? 'SI' : 'NO') . "\n";
?>