given the following script
I get the expected
The second code sample is an outright syntax error. This means PHP will not progress to the point of code execution and will die at parse time. Since no code is executed, the effects of the ini_set()
call are not seen, so you do not get the PHP textual error indicating the problem.
A parse error is fatal, and the web server is (rightly) set to handle PHP fatal errors with a 500 response code. Since your PHP script did not produce any output the web server will return it's default error document for the 500 condition.
If you want to see the textual message for parse errors in the browser - and one wouldn't normally do this is production, by the way - you will need to turn error reporting on in php.ini or using a .htaccess file.
If forcing php to show error on run time doesn't work for you, you may try other options like setting it in php.ini instead:
error_reporting = E_ALL | E_STRICT
display_errors: On
Good Luck!