$reset_Array=(); // I forgot to put the keyword "array"
Correct way should be
$rest_Array= array();
Why does Apache crash when I try to execute wrong code.
What is happening internally?
I don't think that Apache crashes. What happens is your PHP execution aborts, resulting in you seeing 500 Internal server error. This is due to the fact that syntax
$reset_Array=();
is invalid in PHP. PHP is trying to parse this line and encounters an error. It returns this error and the execution aborts. Try the following: put in a new file test.php the following:
<?php
$reset_Array=();
?>
And execute this with a command-line interpreter with -l parameter (lint - syntax checking):
$ php -l test.php
You will get the following error:
$ php -l publish/test.php
PHP Parse error: parse error in test.php on line 3
Errors parsing test.php
Once PHP encounters this error, it cannot continue executing the script, because it cannot parse it. Hence you receive an error when you try executing it under Apache.
P.S. The above commands are shown from unix/linux shell. If you are running under windows, then your prompt may be something like C:\Documents > instead of $.
Apache isn't crashing. It's just no errors are being displayed.
You could look at the errors in the error_log file, which resides in the same directory as your php script.
What you could do is look in your php.ini file for the uncommented line error_reporting = foo. Change that foo to E_ALL.
Then it should show the errors, instead of just simply so-called 'crashing'.
500 Internal server error.