Great job! Really great job! Just tested it on CentOS 6.9 (Final) and works. There are few errors which needs to be fixed, but it works. For example instead of using unset($result) which is giving error, use $result = null; and later put something in that var.
Needs a bit fixing, because it`s not showing anything after you install a Wordpress, but everything else is ok. Once again - Great Job!