Ask for advice! HTTP ERROR 500 error, no prompts on the console. How to quickly lock the error location of the code?
小小的菜2018-04-23 11:50:36
0
2
1308
As shown in the picture, this kind of error occurs during runtime. There is no specific error prompt on the console. How can I quickly find the error location in the code?
Let me talk about my solution. I hope it will be helpful to the original poster.
First check the logs of nginx or apache (see what your own server is). Check to see if there are any errors. If there are errors, resolve the corresponding errors.
Then put a breakpoint in index.php (project entry). Determine whether the project can be accessed normally.
Then you will see the wrong URL, find the corresponding controller, and breakpoint on the first line of the controller to see if it can be accessed. If it cannot be accessed normally, there is a problem before the controller is found. . If there is __construct. Just check if it's here.
In short, break the point where you think there may be a problem and see if the program reports an error. If an error is reported, there is a problem before the breakpoint. If no error is reported, the problem is below the breakpoint.
Let me talk about my solution. I hope it will be helpful to the original poster.
First check the logs of nginx or apache (see what your own server is). Check to see if there are any errors. If there are errors, resolve the corresponding errors.
Then put a breakpoint in index.php (project entry). Determine whether the project can be accessed normally.
Then you will see the wrong URL, find the corresponding controller, and breakpoint on the first line of the controller to see if it can be accessed. If it cannot be accessed normally, there is a problem before the controller is found. . If there is __construct. Just check if it's here.
In short, break the point where you think there may be a problem and see if the program reports an error. If an error is reported, there is a problem before the breakpoint. If no error is reported, the problem is below the breakpoint.
Find it step by step.