All you should be needing to do is:
apt-get install php5-gd php5-mysql
You should not need to edit anything else, This should cause the extension=
stuff to be added to /etc/php5/conf.d files which will automatically be included.
Check the output of the phpinfo()
function to see if the modules are enabled or not. Note that although you shouldn't need to edit them, there are separate php.ini files for apache2/cli/cgi in, for example, /etc/php5/apache2/php.ini
If your /etc/php5/conf.d directory is empty, and those packages are already installed, someone must have deleted files from there, in order to get apt to restore them, run:
apt-get -o DPkg::Options::='--force-confmiss' reinstall php5-gd php5-mysql
The reason you'd have to do this, is that dpkg assumes that if you deleted conffiles, you did it for a reason, and it doesn't want to revert your change.