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@xxxxxxxxxxxxx] Sent: Sunday, October 09, 2005 3:50 PM To: php-general@xxxxxxxxxxxxx Subject: 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.? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php