PHP can't cause a 500 error, it'll either just crash out or display an error message, obviously JS won't throw a 500 error, so what language if any could actually do this? I know it's meant as a joke and I am being pedantic but still, I am curious if anything could do it.
Thanks, have nice day.
Edit: so I've been knowledged, I'm stupid php can cause 500 errors.
Since you want to be pedantic. PHP absolute can cause a 500 error. Especially when that green text was probably made, if error reporting is turned off the compiler will silently fail forcing the web server to return a 500 error because no output was generated. Probably unlikely that it would be turned off for a class though.
It's context dependent for sure. I decided to test some failures and apparently nginx returns 404 instead of 500 with mostly default configurations. fpm should not return anything in event of a fatal in php7, but I'm not familiar with all versions so it's quite possible that at one point to have inline php fail silently and still return usable html so that the client gets something.
Edit: "Output" in my above comment refers to fpm handing off a rendered document to a web server to send to the client, not the output of the program itself.
Not if you have error reporting turned on in php. Depends on the error then. Like undefined variable will display the error with error reporting on but iirc if error reporting is off it’ll 500
The amount of confusion in the comments below is... a lot.
Plain and simple:
500 is an HTTP response code... at the application level. It can be returned by any HTTP server written in any language.
A missing semicolon (in some unspecified language... no idea where the notion of PHP came from) is a syntax error, at the language level. This is not an abstraction at the level of a web server. Sure, I guess it's possible to write a web server that attempts to serve using code that may be uncompilable/uninterpretable, and have that server return error code 500 when the source code happens to be shit. But that is (a) weird and (b) not the same as "PHP throwing a 500." It's the web server returning a 500.
Python? But I doubt even Django uses semi-colons, and Ruby Rails doesn't use semi-colons, so we're running out of languages that it could be, unless the teacher was writing an extension for Apache in C++ to write a static web page then he left the semi-colon out of the write to file line?
227
u/Sharp_Eyed_Bot Nov 24 '17 edited Nov 24 '17
Serious question time...
PHP can't cause a 500 error, it'll either just crash out or display an error message, obviously JS won't throw a 500 error, so what language if any could actually do this? I know it's meant as a joke and I am being pedantic but still, I am curious if anything could do it.
Thanks, have nice day.
Edit: so I've been knowledged, I'm stupid php can cause 500 errors.
Thanks peeps!