If you are on a shared hosting and not understanding very well how to play with chown/chmod commands, I think the best you can do is unfortunely with 777 and make sure the .htaccess file is always present in the data folder, this will deny attacks from the web for sure but the weakness is if another customer is hacked and a worms infects the machine, that worm will have a write access here, this is not really your fault but the webhost than runs apache as php module, if you are on a VPS or dedicated server then you have to learn how to run php as cgi and you can go down to a stricter chmod like Im doing with 750, you can go down to php files to 400, works fine here, but not simple & easy to setup all this, 777 saves time but not your ass heh