Fatal error: Uncaught Exception: message in file.php:12
An exception was thrown and nothing caught it, so PHP stopped the script.
Seen on:
PHP
Meaning
The message after “Uncaught Exception:” is the real error, followed by the file/line and a stack trace. Frameworks normally catch these and show an error page; plain scripts don’t.
Common causes
- Exception thrown in your code or a library with no try/catch
- Exception thrown in a destructor or shutdown function
- Missing global exception handler
⚡ Quick fix
- Read the message and the first stack frame in your code
- Catch expected exceptions where you can handle them
- Register
set_exception_handler()to log and show a friendly page
Detailed fix by platform
PHP
set_exception_handler(function (Throwable $e) { error_log($e); http_response_code(500); echo 'Something went wrong'; });
How to diagnose
- Message — What does it say?
- Origin — First frame in your code
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026