Re: chown(), chgrp()
| From: | Steve Edberg | Date: | Tue, 19 Sep 2006 16:09:19 +0000 |
| Subject: | Re: chown(), chgrp() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241948@lists.php.net to get a copy of this message | ||
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@informed-sources.com http://www.informed-sources.com-- +--------------- my people are the people of the dessert, ---------------+ | Steve Edberg http://pgfsun.ucdavis.edu/ | | UC Davis Genome Center sbedberg@ucdavis.edu | | Bioinformatics programming/database/sysadmin (530)754-9127 | +---------------- said t e lawrence, picking up his fork ----------------+