After further investigation - seems that connecting from PHP to MySQL server through SSH is not really a well developed solution.
However - you can actually already do it by installing such tunnel on your server first that maps to local post and connect to that port. A good tool for that is autossh
Read for background info: