Re: Mystery about chmod and permissions

From: Date: Sun, 09 Oct 2005 23:56:54 +0000
Subject: Re: Mystery about chmod and permissions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-223796@lists.php.net to get a copy of this message
Jeffrey Santos wrote:
To save on computing time, the results of the fileperms command are cached... I assume when you run a new instance of the program, it uses a new cache / old one is deleted when the first instance ends. Either way, you should clear the cache first: clearstatcache(); echo "Directory permissions for $dirname: ". substr(sprintf('%o', fileperms($dirname)), -3). " //reports 0755; Give that a try - Jeff -----Original Message----- From: Al [mailto:news@ridersite.org] Sent: Sunday, October 09, 2005 3:50 PM To: php-general@lists.php.net Subject: [PHP] Mystery about chmod and permissions I've got a script that checks a directory's permissions for 757 and if they are not correct, chmods them with a cgi script. That part works just fine. Can alternately switch the permissions from 755 to 757 and back. I can use a ftp utility to check the permissions and they are correct. The mystery is that I have a permissions check following the chmod and it reports the permissions that existed before the change. snippets: include "http://$server/cgi-bin/chg_perms.cgi?name=$fp_name&perms=$fperms"; //e.g., $fperms= 0757; [I've tried sleep(10) here; doesn't help] echo "Directory permissions for $dirname: ". substr(sprintf('%o', fileperms($dirname)), -3). " //reports 0755; If I run the script again with the same permissions, the report shows the correct permissions. It's as if permissions check code is executed before the chmod; but it isn't. I've tried echoed the times for the chmod code and the permissions check and the chmod code is definitely before the permissions check. Anyone have an explanation.? That did it. Thanks....


« previous php.general (#223796) next »