Apache Lounge



Forum Index Downloads Search Register Log in  RSS Apache Lounge

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.

How emulate read and write chmod data for files on Windows?

Post new topic   Reply to topic    Apache Forum Index -> Apache

View previous topic :: View next topic  
Author Message

Joined: 24 Feb 2018
Posts: 4
Location: Russia

PostPosted: Tue 06 Mar '18 19:47    Post subject: How emulate read and write chmod data for files on Windows? Reply with quote

I have local and web-server Apache. When I get chmod with php function for file, application return wrong information about file. But I know that information with properties keep in the meta-data of file. Some times possible change rules of acces with Windows included utilites, but this work incorrect. Other fact. When moving files from local machine on web-hosting (or backward) not changing a really properies of file keep in it.

Is there plugin, or methodic, or the way that is understood apache server how to reading meta-data of chmod parameters?
How will made possible read and write chmod data for Apache on Windows OS?

-- sorry about my english
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6414
Location: Germany, Next to Hamburg

PostPosted: Thu 08 Mar '18 13:48    Post subject: Reply with quote

On Windows you can't make use of chmod. But you can get the owner and the group.


function getOwner($file,$path){
   $GetFileOwner = "n/a";
            $sVerz = str_replace("/", "\\", $file);
            return 'n/a';
            $SWbemServices = new COM('winmgmts://');
            $SWbemObjectSet = $SWbemServices->ExecQuery("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" . $sVerz . "'} WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner");
            foreach($SWbemObjectSet as $SWbemObject){
                $DomainName = $SWbemObject->ReferencedDomainName;
                $Account = $SWbemObject->AccountName;
                $GetFileOwner = $DomainName . '\\' . $Account;

            return $GetFileOwner;
            //Unix / Linux
            $stats = stat($file);
            return $stats['4'];

   function getGroup($file){

         return "n/a";
         return $stats['5'];

Back to top

Post new topic   Reply to topic    Apache Forum Index -> Apache
Page 1 of 1