This is now done by stage 5 of the installer and has been completely automated for all CentOS, RedHat Enterprise, Ubuntu, Debian, SUSE Enterprise and openSUSE systems that need it.
If you want to re-apply the settings, I would advise downloading the Installer and only let it do the stage where it sets up your Apache configuration and PHP settings. It will leave your existing Apache configuration alone if you have already set it up.
But for reference, here are the settings.
In CentOS, all these settings should go into /etc/php.ini.
In Ubuntu, all these settings should go into /etc/php/*/apache2/php.ini.
In Ubuntu, you should also add this line to /etc/php5/cli/php.ini: