You can execute this command with system or exec to add your users.
I created a code snippet that might work for you:
<?php define('HTPASSFILEPATH', '.htpasswd'); function addUser($pUser, $pPass) { exec("htpasswd -cb " . HTPASSFILEPATH . " ${pUser} ${pPass}"); } ?>
And remember that the htpasswd
tool must be in your PATH
source share