In my case I had to do some fixing on my closing php tags, such as Instead of writing
->Mixing of PHP and HTML is slightly confusing so it is recommended to notice some differences between writing these also:
<? } ?>
-> short_open_tag on your php.ini file could be another reason of throwing that kind of error.
set it to:
The error "unexpected end of file" usually means you have a php code block that is not properly closed or somehow is not terminated yet. So the code is unable to be parsed anyway.
Another piece of code is still missing until end of file which is expected by the PHP compiler.
Hope that helps!