Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can i use chmod in php

Status
Not open for further replies.

Qwark

Programmer
Sep 26, 2000
59
NL
I would change the permissions (chmod) of a directory (in Linux) via the internet with a php-script. Is it possible to use that chmod command in a php-script. If the answer is yes tell me how.

Thank you,

Qwark
 
From the PHP documentation:

[tt]

int chmod (string filename, int mode)


Attempts to change the mode of the file specified by filename to that given in mode.

Note that mode is not automatically assumed to be an octal value, so strings (such as "g+w") will not work properly. To ensure the expected operation, you need to prefix mode with a zero (0):


chmod ("/somedir/somefile", 755); // decimal; probably incorrect
chmod ("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect
chmod ("/somedir/somefile", 0755); // octal; correct value of mode





Returns true on success and false otherwise.
[/tt]

Hope this helps,

-Vic vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top