Glad to see, that changes are trickling down by time The exact steps depend on what you want to archive.
If you only want to fix the memleak, you can go with the files I provided. I updated them and removed the GBX Data Fetcher as Xymph already merged the changes to version 2.9 which has been released recently (see update notice https://ftp.bueddl.de/tm/php7_patches/). It is better to obtain them from the original upstream source

Second is, you'll have to deal with the removal of the old-style mysql API. Changes are described above and on the tiny site I put on the web. If you want a minimal effort solution, go with reabys plugin. Otherwise I suggest to perform the replacement of the procedural API with the object orientated one.