Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. 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

closed as unclear what you're asking by Adnan, 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

1 Answer 1

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.