Thank you for your input.
While troubleshooting the issue, I found that the error is due to the below code. It is not able to save the report properly. If I comment out this line of code then the System
500 error is not displaying.
$objWriter->save(str_replace('.php', '.xlsx', $finalreportname));
$objWriter->save($finalreportname); - The code without the string replace is also not working.
Is this related to some file/folder permission. I am saving the report in a folder name 'report' which is under the project folder. Can this be related to some permission?
Any solution approach or suggestion to resolve this issue is much appreciated.