0

In my PHP aplication,I want that whenever -Internal Server or 500 error occurs,I want the error code to be changed from 500 to 302.I mean error code 302.

  • 3
    Why would you want to do that? It will only confuse users. – Sablefoste Apr 09 '14 at 11:15
  • 3
    You want to cure the symptom instead of fixing the cause? Don't! – arkascha Apr 09 '14 at 11:15
  • http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm – Lal krishnan S L Apr 09 '14 at 11:17
  • actuallly i am testing the application by appscan, and it advises us to change 500 error to 302. 500 error is a security breach error and it means that the ap can be hacked but 302 error is safe error in terms of app security. so th neeed to change the code – user2750239 Apr 09 '14 at 11:37

2 Answers2

1

Try to use http_response_code.Also, take a look on related question How to return an HTTP 500 code on any error, no matter what.

Community
  • 1
  • 1
Mihai8
  • 3,113
  • 1
  • 21
  • 31
0

i would not recommend you do that.

Instead wrap your code that is generating this error within a Try & Catch statement and try to handle exception there.

try {
   // your code here
} catch (Exception $e) {
   echo $e->getMessage();
}
Guns
  • 2,678
  • 2
  • 23
  • 51
  • can u post the full code i mean if the error is 500 then the full code to handle that error 500 – user2750239 Apr 09 '14 at 11:38
  • you will have to post the source code by editing your question which can help us understand why you have error code 500 – Guns Apr 09 '14 at 11:39
  • 500 error is not aceptable by appscan which isa software to test for application security. 302 is aceptable thats y we need to change the eror code – user2750239 Apr 09 '14 at 11:39
  • you cannot expect an answer to your question without a source code, what have you tried, etc. – Guns Apr 09 '14 at 11:40
  • if we change the parameters passed in url to values like %27 then – user2750239 Apr 09 '14 at 11:41