PHP--Permissions, what is good, and what is not!?

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Gets Obvious Implications
Posts: 785
Joined: Sat Jun 09, 2007 8:38 am UTC
Location: USA

PHP--Permissions, what is good, and what is not!?

Postby Earlz » Sat Aug 11, 2007 4:59 pm UTC

Ok, I am making a simple thing in PHP, the thing is, it should work with most hosts. The problem is that if I upload the directory to my host, the default mode is (iirc) 0644. This will keep me from reading or writing some files that are used for temporary purposes or caching. I heard from a friend that I should avoid changing permissions due to security reasons, and you can't chmod usually unless your the owner, and to chown, you have to be a superuser...I really don't want to rely on this being true, so what should I do?
My new blag(WIP, so yes it's still ugly..)
This is microtext. Zooming in digitally makes it worse. Get a magnifying glass.. works only on LCD

Posts: 150
Joined: Tue Jan 30, 2007 3:58 am UTC

Re: PHP--Permissions, what is good, and what is not!?

Postby iw » Sun Aug 12, 2007 8:53 am UTC

If it's temporary storage, you don't upload it. You can simply create it in the PHP script and chmod it to whatever you like. Your friend was probably trying to protect you from changing the permissions to make sure you didn't screw anything up ;)

Posts: 9
Joined: Fri Aug 31, 2007 2:43 am UTC

Postby paranoid_one » Fri Aug 31, 2007 4:42 am UTC

0644 is usually fine, as long as the files don't have the user of the webserver as its owner. this would make them writeable.

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests