Jump to content


Photo

simulate 500 server error


  • Please log in to reply
4 replies to this topic

#1 Drongo_III

Drongo_III

    Advanced Member

  • Members
  • PipPipPip
  • 501 posts

Posted 13 June 2013 - 05:07 PM

Hi Guys

 

Bit of an odd one. I've created a custom 500 error page and my hosting company has told me that they've made the necessary httpd.conf changes.

 

The thing is - how do you simulate a 500 server errror?

 

I've tried throwing an exception but this did nothing. I've also tried breaking a htaccess file but this doesnt display my custom page, which leads me to think that the configuration hasn't been setup properly. But as I'm not sure if this is a valid way to test it I thought I would get some advice.

 

Any helo would be appreciated!

 

Drongo


Learning something new simply uncovers how much there is left to learn...

One day when I know what I'm talking about all my noob posts will come back to haunt me. But I shall rejoice in the cleansing light of knowledge over ignorance :)

#2 requinix

requinix

    Playful Member

  • Moderators
  • 5,744 posts
  • LocationWA

Posted 13 June 2013 - 05:18 PM

You may be able to put random nonsense in your .htaccess, and after the ErrorDocument if you had to add one in there. Or definitely in the .htaccess of a subdirectory.

FYI PHP only triggers 500s in certain installations.

#3 txmedic03

txmedic03

    Advanced Member

  • Members
  • PipPipPip
  • 313 posts
  • LocationCall, TX, USA

Posted 26 June 2013 - 10:04 AM

Try something like:

<?php

require_once('/made/up/page/that/does/not/exist.foo.bar');

?>

If it is a 500 error you want then, provided your service provider has configured the server correctly for a production environment, requiring a non-existent page will throw a fatal (500) error.


SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#4 dalecosp

dalecosp

    Advanced Member

  • Members
  • PipPipPip
  • 281 posts
  • LocationJoplin, MO

Posted 26 June 2013 - 10:07 AM

Write something in Perl or ASP and try and run it.   :tease-01:   </rimshot>

But, seriously, that might work.  A deliberate syntax error in a *.pl file in your cgi-bin directory would probably trigger a 500.


 


"God doesn't play dice" --- Albert Einstein
"Perl is hardly a paragon of beautiful syntax." --- Weedpacket

#5 ragax

ragax

    Advanced Member

  • Members
  • PipPipPip
  • 186 posts
  • LocationNelson, NZ

Posted 25 July 2013 - 09:03 PM

How about:

<?php
http_response_code(500);
?>

If I recall this is for 5.4 or above.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com