Re: chown(), chgrp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 11:01 AM -0400 9/19/06, Rahul S. Johari wrote:
Is there a way to find out if a file can be chown'd or chgrp'd ? Something
like is_writeable() ... Except that you're trying to find out if you can
change the Owner or Group of a file.


fileperms() perhaps?

	http://php.he.net/manual/en/function.fileperms.php

You'd have to compare the return value against the uid/gid the webserver runs as, which can be obtained via getmyuid()/getmygid():

	http://php.he.net/manual/en/function.getmyuid.php

Alternatively, you could check if the file exists, then attempt to chown/chgrp it. If the chown()/chgrp() returns false, you probably don't have permission.

	steve


Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: rahul@xxxxxxxxxxxxxxxxxxxx
http://www.informed-sources.com


--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center                            sbedberg@xxxxxxxxxxx |
| Bioinformatics programming/database/sysadmin             (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux