Drongo_III Posted June 13, 2013 Share Posted June 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/279133-simulate-500-server-error/ Share on other sites More sharing options...
requinix Posted June 13, 2013 Share Posted June 13, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/279133-simulate-500-server-error/#findComment-1435867 Share on other sites More sharing options...
txmedic03 Posted June 26, 2013 Share Posted June 26, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/279133-simulate-500-server-error/#findComment-1437998 Share on other sites More sharing options...
dalecosp Posted June 26, 2013 Share Posted June 26, 2013 Write something in Perl or ASP and try and run it. </rimshot>But, seriously, that might work. A deliberate syntax error in a *.pl file in your cgi-bin directory would probably trigger a 500. Quote Link to comment https://forums.phpfreaks.com/topic/279133-simulate-500-server-error/#findComment-1437999 Share on other sites More sharing options...
ragax Posted July 26, 2013 Share Posted July 26, 2013 How about: <?php http_response_code(500); ?> If I recall this is for 5.4 or above. Quote Link to comment https://forums.phpfreaks.com/topic/279133-simulate-500-server-error/#findComment-1442224 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.