Thanks Till. That did the trick.
I noticed that when I run this script from the default profile it works, but when I run it from a client vhost it does not. I think this is an issue of what PHP is allowed to do for that vhost? Why would it work in the default site, but not under client sites I create?
Just curious if you have any suggestions.
Thanks again, your solution got me running.