No offence, but if you are developing on a unix system and you don't know how to change file permissions, you might want to do a "unix for beginners" course or something. That would answer a lot of your questions.
On a unix system, you can change file and directory permissions using the "chmod" command.
If you type "man chmod" you will get an explenation of how it works, probably much better than I can explain it.
Also, look at which user runs your scripts (which user runs the webserver if you are running your scripts through a webserver) and which user owns the directory in where you want to write in.