The most immediate question that comes to my mind is that the script file is 30 lines long, but the error occurs on line 46.
So two questions that immediately come to mind are:
- Is it the same file?
- and, is the file being misinterpreted in some way?
Can you test on an unpacked version of the script? That will help to confirm whether the problem is due to the format of the file, or some part of the actual script.
If you still get the error with the script, add in line breaks to confirm you have the right location for the error. Then you can focus on the content of that part of the script, to determine why the error is being thrown.
For now though, my money is on an interpretation issue relating to the file as a whole, which is something that the good people in the Apache Configuration forum might be able to help with.
If it's not due to the file format, you may want to look in to cross-domain issues instead, due to the "access is denied" message.