How to remove comments and empty lines from `php.ini`?

See also: How to remove the # comments and empty lines from a configuration file?