If you are getting 500 errors for cgi scripts, make sure proper permissions are set. If everything is set correct and you are not able to locate any error in logs just perform the following fix.
Open your cgi file in your favourite editor, at the fist line, put “-w” at the end. Save it and execute.
Thats it.