Compiled a PHP, how do I load it in Apache?

I compiled and install PHP7.1.7 from source on Ubuntu16. I followed this tutorial:
http://www.shaunfreeman.name/installing-php-7-on-ubuntu-16-04/

I followed it upto the place he adds something to the modules.ini files.

Now, Apache was not loading any php, so I installed

sudo apt-get install libapache2-mod-php

Now apache loaded PHP, but the versions were different, and also did not have the PDO drivers I compiled with. I checked this using phpinfo()

Apache showed 7.0.18, while I installed 7.1.7. I don’t know how this second version got installed (perhaps libapache2-mod-php ?)

Also the php executable in /usr/bin was 7.0.18, so I deleted that and created a symlink to my 7.1.7, so at least in the terminal the php works with the correct version.

I need to make Apache to work with this new version.

Things tried:

  • Many other answers(like this one) on the same issue said that I just needed to load the different module in my apache2 config. But I cannot find a module on my system that relates to the php7.1.7. I do have a php7.0, and I believe that is what apache is loading.