Server error 500 [closed]

2019-09-22 04:24发布

I am working on drupal7.

When I try to open the website, it gives internal server error:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

But when we open this on Firefox, it does nothing. Any idea?

2条回答
我想做一个坏孩纸
2楼-- · 2019-09-22 04:58

This is due to the error in the code.Enable error reporting and see what happens.

This code will help you-

ini_set('display_errors', '1');
error_reporting(E_ALL ^ E_NOTICE);

Read more- http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm

查看更多
迷人小祖宗
3楼-- · 2019-09-22 05:06

The PHP script gives an error but since your PHP settings are set to production mode it don't produces an error and leaves the error handling to your webserver (most of the times Apache).

You can do one of the following things:

  1. Locate the CORRECT php.ini file and change error_reporting to E_ALL and display_errors to 1 (restart server is neccesary).
  2. Put this in the first loaded PHP file (index.php?) error_reporting(E_ALL); ini_set('dislay_errors', 1);
  3. Each webserver has it's own error logs you can also check this in stead of let PHP output the error, see (http://httpd.apache.org/docs/2.0/logs.html).

But when you do one of the things above you only will see the error message, fixing the problem is step two.

查看更多
登录 后发表回答