You can also try to run your script on the command line first and see how it behaves.
In reply to Re: 500 internal server error !! by moritz in thread 500 internal server error !! by priti