Creating a PHP CHOWN Script for file manipulation

Posted by · October 22, 2013 9:18 am

accepted solutionExperts Exchange community member BoltonWanderer had a problem. He needed a PHP script to modify the ownership of site content files so they would be accessible for an Apache web server but wasn’t quite sure how to write it. While he planned to avoid this issue in the future by setting up his domain differently, he needed a quick update to a site that was currently live, and he needed it fast.

Less than two hours after he posted his question, BoltonWanderer received the exact code he needed from web development genius COBOLdinosaur.  In addition to the code, however, COBOLdinosaur also posted a warning about securing the function off the server when it is not being used.

“I think you should be able to mount this (code) on a page so it runs off the server.  Don’t leave it on the server because in the wrong hands it would be dangerous,” COBOLdinosaur said.

PHP expert Ray_Paseur confirmed that both COBOLdinosaur’s code and warning were correct and also added an enhancement to improve access for the web server. After testing COBOLdinosaur’s code for himself, BoltonWanderer returned to the thread to post the code as implemented from the supplied script, making both the base for the script and a practical implementation of it available to other community members who might face the same issue.

This blog post is part of our Featured Solutions series. These posts highlight relevant technology solutions on Experts Exchange and the experts who took the time to provide a quality answer. For exclusive access to over 3 million technology solutions, join the Experts Exchange community for free** today!