Decompressing archive and setting files' owner

Posted on 2006-05-03
Medium Priority
Last Modified: 2011-09-20
I'm creating an install program which needs to decompress an archive and make sure all files extracted are set to the hosting account owner which is proving harder than I thought! It's my own server and only running code which I control and so I'm using apache/mod_php rather than php as CGI/FastCGI etc although I'm considering the those options given the hassle of this.

At the moment I'm using PclZip to decompress a zip file and therefore the files extracted are owned by "apache" group/user. I then tried to use chown() and chgrp() to change the file/folder ownership/group but I get the error message "Operation not permitted" for both functions.

Surely there must be an easier way to do this? Thanks in advance for any help!
Question by:wjdashwood
LVL 49

Accepted Solution

Roonaan earned 1500 total points
ID: 16622214
You might possibly be able to sudo a chmod / chown using exec() or system() function. This depends on your server security settings though.


Author Comment

ID: 16625564
Tried that and afraid that doesn't work but I think there may have been an error in the code I used original using PHP's own chown() and chgrp() functions so I'll go back and try that if there isn't an alternative.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question