Permissions help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Permissions help please

Post by mjseaden »

Hi there,

One of my PHP scripts, strangely enough, generates PHP code and saves to a .php file in my public_html directory (Linux Apache server).

I initially had my permissions set to 757, which gave me permissions errors when trying to use fopen() to open a file for writing in my public_html directory.

So, I've temporarily (very temporarily!) set the permissions to 777 so that I can write. However, what's the best permissions to set my public_html directory to so my PHP scripts, run on the server, can write to public_html but won't leave my public_html directory completely vulnerable to hackers.

Many thanks

Mark
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Hi Mark,

Why don't you just set the permissions of the file you want to write to? If every run of the script creates a new file, I suggest creating a directory within public_html and setting that to 777.

Good luck.
Post Reply