sudo apt-get install php5-gd php5-mysql
Once complete, you will need to restart the PHP service. Depending on how it was installed, you will need to do one of the following items:
If you installed it via LAMP (Linux Apache, MySQL, PHP5), then you'll need to restart the entire apache instance with:
sudo service apache2 restart
If you installed PHP from a separate service, like php5-fpm, then use
sudo service php5[tab] restart (where you actually press the "tab" key where it says [tab]) After that, your php5 should have those extensions loaded.