what are preconditions for making mkdir() working ?

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
olko
Forum Newbie
Posts: 6
Joined: Fri Jun 16, 2006 2:09 am

what are preconditions for making mkdir() working ?

Post by olko »

Hi everybody,

I am running Suse 10.1 installation of LAMP.

There is a directory, let's say /foo - created by root, ownership is changed - Apache is the owner,
PHP runs as Apache module. If I am not mistaken PHP has the same rights as Apache.

What else should I do to make mkdir() able to create new directories in /foo ?

Thank you,
Yuri
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

chmod 0777 on the directory other wise you won't be able to write and thus won't be able to make a directory.
olko
Forum Newbie
Posts: 6
Joined: Fri Jun 16, 2006 2:09 am

Post by olko »

what are consequences of making it 0777?
will everybody accessing the website able to write in the directory ?
olko
Forum Newbie
Posts: 6
Joined: Fri Jun 16, 2006 2:09 am

Post by olko »

Another thing - PHP runing as Apache module has Apache's rights, moreover it's Apache self.
I've already changed the ownership of /foo to Apache, it's 0755 in the /foo permissions.

It's logical to expect that PHP is able to write in /foo.

Do you happen to know why it should be 0777?
I am bit worried by giving to 'others' write permisssions..
olko
Forum Newbie
Posts: 6
Joined: Fri Jun 16, 2006 2:09 am

Post by olko »

btw..

php is able to write a file in /foo even with 0755..
why it needs 0777 for mkdir ?
Post Reply