You are here: RE: [PHP] Mystery about chmod and permissions « PHP « IT news, forums, messages
RE: [PHP] Mystery about chmod and permissions

Posted by "Jeffrey Santos" on 10/09/05 22:58

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.?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация