How to remove the `#` and `;` comments and empty lines from a configuration file?

See also: How to remove comments and empty lines from a php.ini?