Php exception cannot be caught?

introduce the file b.php into the file a.php and execute a function c in b.php in a.php. At this point c throws an exception that cannot be caught in a. Environment: nginx,php-fpm.
nginx Direct 502

excuse me. Post the code and error below:
code in a.php

clipboard.png

nginx

clipboard.png

bpdob.phpcatchb.php:

clipboard.png
in addition, php-fpm does not have any error logs.

Mar.16,2021

what are you talking about? there are no


pictures. < H1 > Don't paste the code if you can! < / H1 > < H1 > what to do means you can use comments! < / H1 >

I'll give you some advice from your question:

  1. look at nginx's error log. Nginx can generally give you a good feedback.
  2. if you look at the error log of php-fpm, you can basically locate the error of PHP.
  3. generally speaking, there is something wrong with your program. I suggest you use catch (Error $e) to catch errors at the same time. If you report an error, you can't catch it without Error. Exception can only catch exceptions.

keep the above three points in mind.

< hr >

update the answer:

you can see from your code that you are using

  official documents  

Menu