webmin allows you to connect via what ever port you define. The functions used to allow that are not available to PHP (correct me if I'm wrong).
I haven't looked at what permission schema webmin uses to make changes to files owned by root, but I know doing it with PHP, the product would be hmmm.... I like PHP alot ...not something you would want to use on a production system.
This is where perl is better...
Sorry, I know I didn't answer your question (+:
CT