Troubleshooting Botlify, PHP and Telegram Errors
PHP and runtime handbook
- Botlify Feature Map: What to Use and Why
- Bot Data, SQLite and Durable Work
- Authorization, Callbacks and Bot Credentials
- From a Working Demo to a Maintained Bot
- Botlify PHP and Runtime Handbook
- Equivalent Complete Bots: Helper PHP and Plain PHP
- Updates, Callbacks and Persistent State
- Bot Operations: Cron, Testing, Performance and Releases
All Telegram helpers and API features · Loader and cron migration
Identify the failing layer
| Symptom | Likely layer | Next check |
|---|---|---|
| Undefined tg_allfun() | Bot code spelling | Use tg_all_fun();, not tg_allfun();. |
| Undefined tg_all_fun() | Runtime/entrypoint | New loader not deployed or standalone PHP without Botlify runtime. |
| Undefined tg_send() | Loader/code path | Call tg_all_fun before the first helper, including cron entrypoints. |
| chatId must be string, int given | Older helper signature | Deploy the current int|string-compatible helper runtime; confirm actual server file. |
| Missing telegram_api_helpers.php | Old deployment | Current suite is inside telegram.php; deploy matching runtime files. |
| Bad Gateway / 5xx | API/network path | Record response/time; retry only where the operation is safe to repeat. |
| Too Many Requests / 429 | Telegram rate limit | Respect parameters.retry_after and reduce/requeue requests. |
| cURL timeout | Network/remote response | Inspect elapsed time and connectivity; timeout alone cannot prove non-delivery. |
| MySQL 1045 Access denied | Platform DB authentication | Verify deployed username/password/host privately; do not paste credentials. |
| PHP Startup: snmp.so dependency missing | Hosting PHP configuration | Ask the host to repair the extension/dependency; unrelated to a tg helper call. |
| Sandbox blocked function | Hosted execution rules | Use supported APIs and direct function calls; inspect the reported line. |
Loader placement
<?php declare(strict_types=1); tg_all_fun(); // First helper call comes below this line. tg_send($chatId, 'Hello');
If you choose plain PHP/cURL, remove native helper calls as well as the loader. A helper cannot work while its definition is deliberately absent. The runtime uses normal PHP error handling; do not assume a custom missing-loader message is installed.
Read API responses
tg_all_fun();
$result = tg_api_get_me();
if (!($result['ok'] ?? false)) {
$errorCode = $result['error_code'] ?? null;
$retryAfter = $result['parameters']['retry_after'] ?? null;
// Log a sanitized diagnostic; choose retry/requeue behavior for the operation.
}API failures often return an array rather than throwing a PHP exception. Catching Throwable alone does not test result.ok. Conversely, type errors and missing functions are PHP exceptions/errors, not Telegram responses.
Collect a useful report
Include the timestamp, PHP version/SAPI from the actual execution path, command/action, method name, sanitized error code/description and relevant code lines. Remove tokens, passwords, authorization headers and token-containing URLs. Separate historical log entries from errors after the latest deployment. A successful test later in the day can mean an earlier deployment failure is already resolved.
Upload limits are not all the same
PHP upload_max_filesize/post_max_size affect incoming PHP uploads. Telegram API download/media limits are separate, as are hosting storage quotas and timeouts. Increasing a PHP browser-upload setting does not automatically increase Telegram getFile limits. Check the method-specific reference before changing a limit.