2

I've been configuring Apache and PHP, and the default config files have a ton of commented-out options, many of which I doubt I'll ever use.

After saving the default file as a backup and tweaking my config to perfection, I thought I might go through and delete most the commented-out lines, to make my config files shorter and more readable.

What's the conventional wisdom on this?

4 Answers 4

4

If I start with the default config I generally leave them in. If I want a cleaner config, which is usually a lot easier to read, I'll rename the default one and build a new one from scratch. That way I can still view the original comments if I later find I need to add some functions or features.

5

Personally I leave them in. A lot of the time, the commented-out directives have their defaults explicitly specified plus a brief description of the purpose and possible values for their field. Makes finding the right words for google searches much faster sometimes.

In general, my theory is that eventually I'll put them in a revision control of some sort so that I can do diffs between what's running and what came with the system so I can quickly see what I changed.

1

I delete the stuff I don't need; it's distracting and annoying. I will, on the other hand, liberally comment my config files with the intent of my configuration, and also links to internal and upstream documentation regarding the configuration (the authoritative reference for the configuration file directives, and any design docs we might have about the machine in question).

1

Make a copy of the original one and call it program.conf.orig or .default , then strip out the comments using egrep -v "^#|^$" program.conf.orig > program.conf and you're left with the actual configuration. If I ever need to reference comments in the original config, I have it there. Also that file then goes into a version control system (pick your poison)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .