By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

chmod doesn't work?

P: n/a
hi all,

I have a file (mode 644) I want to change to mode 777.
The code:
if (file_exists($this->mailAliasFile))
{
echo "file exists<br>";
if (chmod ($this->mailAliasFile, 0777))
echo "OK<br>";
else
echo "not OK<br>";
}

Returns:
file exists
NOT OK

The file is stored on a linux server. Someone knows how I can obtain the rights to modify it?

regards
Stijn
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In message <40***********************@news.skynet.be>, stijn goris
<me*****@hotmail.com> writes
hi all,
*
I have a file (mode 644) I want to change to mode 777.
The code:
if (file_exists($this->mailAliasFile))
{
*echo "file exists<br>";
*if (chmod ($this->mailAliasFile, 0777))
* echo "OK<br>";
*else
* echo "not OK<br>";
}
*
Returns:
file exists
NOT OK
*
The file is stored on a linux server. Someone knows how I can obtain the
rights to modify it?
You gotta own the file or be root to do things like this. It's a Unix /
Linux thing not a PHP thing - PHP is just following the rules of Unix /
Linux.
*
regards
Stijn


--
Five Cats
Email to: cats_spam at uk2 dot net
Jul 17 '05 #2

P: n/a
snip>>
You gotta own the file or be root to do things like this. It's a Unix /
Linux thing not a PHP thing - PHP is just following the rules of Unix /
Linux.


Sound like he wants to do it via his script which I assume would be
the user that the server runs under. Apache maybe?

In *.nix environments, the application 'httpd' (Apache) runs with some
user credentials - usually 'nobody', 'apache' or something similar.
You need to set the permissions so that the user 'nobody' (or 'apache'
or whatever user the httpd process is running under) will be allowed
to read them.

My "/etc/httpd/conf/httpd.conf" file, on line 251 lists:

User Apache
Group Apache

Don't change those, change the files permissions.
maybe chmod 755 /file/in/question depending on your security needs.

Man chmod

Man chown

http://httpd.apache.org/docs-project/
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.