- Complete working image generation app using Imagen 3 - PHP backend with Gemini API integration - Dark themed UI with prompt enhancement - Session management and logging system 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
38 lines
856 B
PHP
38 lines
856 B
PHP
<?php
|
|
session_start();
|
|
|
|
// Security check - only allow in development
|
|
if (!defined('GEMINI_API_KEY') || empty(GEMINI_API_KEY)) {
|
|
require_once 'config.php';
|
|
}
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
// Get the last 50 lines from PHP error log
|
|
$errorLog = ini_get('error_log');
|
|
if (empty($errorLog)) {
|
|
$errorLog = '/tmp/php_errors.log'; // fallback
|
|
}
|
|
|
|
$logs = [];
|
|
|
|
if (file_exists($errorLog)) {
|
|
$lines = file($errorLog);
|
|
$recentLines = array_slice($lines, -50); // Last 50 lines
|
|
|
|
foreach ($recentLines as $line) {
|
|
$line = trim($line);
|
|
if (!empty($line)) {
|
|
$logs[] = $line;
|
|
}
|
|
}
|
|
} else {
|
|
$logs[] = "Error log not found at: $errorLog";
|
|
$logs[] = "Check your php.ini for error_log location";
|
|
}
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'logs' => $logs,
|
|
'log_file' => $errorLog
|
|
]);
|