How to find which block is causing PHP errors?
The most probable cause of the error is a missing or a mismatched parenthesis in the PHP code you are using in your custom blocks or functions. To solve the missing parenthesis error in PHP blocks or in other areas, the code has to be checked from the beginning to search for it. But it's really hard to check all PHP code. One way to avoid errors is to use proper indentation in the code. Once all the parentheses in the code have been set correctly, parse error: syntax error, unexpected $end will be fixed.

What causes this error?

In fact, this error means that PHP has finished analyzing your code, but you forgot to close a symbol somewhere in your page or in those that were included. There could be a number of causes:


This issue could happen when someone used &lt;? instead of &lt;?php somewhere, but your server's php.ini disables short open tags. Check this line in your php.ini - "short_open_tag = On".
You forgot to close a quote, so PHP is continuing to analyze your code until it finds the closing quotation mark.
You forgot to close a bracket, so from the last opening, PHP considers all the code that follows as part of a block that never ends.
You forgot to close a parenthesis, so from the last open parenthesis, PHP considers all the code that follows as part of a specific block (condition, arguments of functions etc) that does not end.
You forgot a comma, so for PHP there is an instruction in your code that has no end.


NOTE: This means that the problem may not be on the line mentioned in the error message, as the missing symbol could be anywhere after that point.