Create new HTTP auth credentials using PHP instead of shell
问题 I know that it's possible to add new HTTP auth credentials through this shell script: htpasswd -c .htpasswd testing Is it possible to achieve the same with a PHP script? I know I could use a regular PHP auth system, but that's not what I'm looking for. 回答1: You can execute this command with system or exec to add your users. I've created a code snippet that might work for you: <?php define('HTPASSFILEPATH', '.htpasswd'); function addUser($pUser, $pPass) { exec("htpasswd -cb " . HTPASSFILEPATH