Улучшена отладка send_plan_simple.php

- Добавлен вывод текущей директории и списка файлов
- Более подробные сообщения об ошибках с контекстом
- Логирование в error_log для диагностики на сервере
- Помогает понять структуру файлов на VPS
This commit is contained in:
Kirik
2025-09-03 15:14:39 +02:00
parent 2957d152a6
commit bf1c7e5d02
+23 -4
View File
@@ -7,19 +7,38 @@
// Отладочная информация // Отладочная информация
error_log("send_plan_simple.php запущен"); error_log("send_plan_simple.php запущен");
// Проверяем текущую директорию и файлы
$current_dir = __DIR__;
$available_files = scandir($current_dir);
error_log("Текущая директория: " . $current_dir);
error_log("Файлы в директории: " . implode(', ', $available_files));
// Проверяем существование файлов (в той же папке /api/) // Проверяем существование файлов (в той же папке /api/)
$helper_path = './forms_helper.php'; $helper_path = __DIR__ . '/forms_helper.php';
$env_path = './.env'; $env_path = __DIR__ . '/.env';
if (!file_exists($helper_path)) { if (!file_exists($helper_path)) {
error_log("ОШИБКА: forms_helper.php не найден: " . $helper_path);
http_response_code(500); http_response_code(500);
echo json_encode(['error' => 'forms_helper.php не найден по пути: ' . $helper_path]); echo json_encode([
'error' => 'forms_helper.php не найден',
'path' => $helper_path,
'current_dir' => $current_dir,
'files' => $available_files
]);
exit; exit;
} }
if (!file_exists($env_path)) { if (!file_exists($env_path)) {
error_log("ОШИБКА: .env не найден: " . $env_path);
http_response_code(500); http_response_code(500);
echo json_encode(['error' => '.env файл не найден по пути: ' . $env_path]); echo json_encode([
'error' => '.env файл не найден',
'path' => $env_path,
'current_dir' => $current_dir,
'files' => $available_files
]);
exit; exit;
} }