I make a class - a wrapper over the stream for interacting with the phar archive. When implementing the stream_metadata method, I encountered a problem: chown and chgrp do not work with files:

chown('phar://path_to_phar.tar.gz/file.name', 'user_name'); 

chown (): Can not call chown () for a non-standard stream

  • 3
    God, why do you need to change the rights inside the phar-archive? - etki

1 answer 1

What is a phar archive? This is just a tar archive in which php sources are wrapped, and which php can execute. Despite the fact that it can be opened like folders from inside PHP, for the file system it is one file. There are no file attachments for the file system, therefore it is impossible to change their attributes, including the owner and permissions.

If this was done for non-academic purposes, then it is necessary to ask exactly the question that was behind the decision to make chmod inside the archive.

  • chmod just can be done - php.net/manual/en/pharfileinfo.chmod.php . I asked about chown. StreamWrapper :: set_metadata can be called to change the owner of the file - so this is the question. - woland
  • Okay, described, chown , - etki