Take a dummy file, chmod it to 777, then point your script at it. 777 is world-writable so if it works you know you have a permissions problem. If it doesn't work then it's probably something else. Either way, delete the file after you run your tests.