Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a php application and somethings related to the application need changes to vhost.conf file.

Presently i'm making the changes manually. But i would like to automate it using a php script.

Is this advisable? I want to know the security complications involved.

share|improve this question
Seems like quite a hack. Not really recommended since your app needs permissions to otherwise root-only scripts. Plus you'd need to reload the server too. What changes do you have to make so often? What's the real issue? – slhck Sep 18 '13 at 13:09

Maybe you can create a file as a config(file) and use the include directive in your vhost.conf to include this file, see

share|improve this answer

You probably want to use the Config PEAR package to edit the files. Of course you are opening a major breach in your server's security, so you'll have to be extra careful about what you allow and must never write any user-provided string to that file (don't think any filtering you apply is smarter than the hacker, even if input is provided by yourself - I'm thinking about XSS and CRSF here).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.