Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

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

closed as unclear what you're asking by Adi, Xander, lynks, Scott Pack, NULLZ Sep 18 '13 at 22:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Please clarify: a standalone PHP script (to be run via the CLI interpreter), or PHP running in a webserver context? – mr.spuratic Sep 18 '13 at 15:22
@mr.spuratic What would be the difference? – david Sep 19 '13 at 5:18

Among the many reasons why I would not even think about doing what you're contemplating, these would be my Top-3:

  1. Security:
    I would never put any file that modifies a system's configuration file in a publicly accessible area. The reason is simple: the publicly accessible area is most vulnerable. If the file gets modded by someone (friend or foe), the modification could cause havoc to both your file system, as well as your server and/or system configuration.
  2. Integrity:
    PHP can (and probably will) mess up file locking. As a result, race-conditions might destroy your vhosts.conf file and break your server configuration.
  3. Recovery:
    Changes to vhost.conf need a server restart for the changes to be acknowledged by the server. You will need to think how you're going to handle that restart via PHP... and what happens when something goes wrong. If your server crashes and takes down the PHP engine while it's at it (remember Murphy's law), how are you going to automatically recover from that? PHP won't be of any help in that case.
share|improve this answer

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