Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

Maybe you can create a file as a config(file) and use the include directive in your vhost.conf to include this file, see http://httpd.apache.org/docs/2.2/mod/core.html#include

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

 
discard

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.