note 41231 deleted from function.shell-exec by betz

From: Date: Fri, 10 Jun 2005 21:38:20 +0000
Subject: note 41231 deleted from function.shell-exec by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-90242@lists.php.net to get a copy of this message
Note Submitter: Jan dot besssai at gmx dot de ---- Here is a safe way to create .htpasswd files for .htacces: <? //first you need $pas (password), $nam (name) and $fname //(filename) if ($pas != "" && $nam!="" && $fname!="") { $stdout = shell_exec('htpasswd -n -b -m ' .$nam .' ' .$pas); //starts the htpasswd and outputs the content of the new .passwd file (don't forget to edit the position of the htpasswd executable) $file = fopen($fname, "a") or die ("Can't Open File!!"); fwrite($file, $stdout); fclose($file); } else { echo "Missing Parameters!"; } ?> This way to do it seems to be strange but it is the only way that really worked for me under Win2k3. You can't let htpasswd generate the .htpasswd file directly with windows because programms started by programms started by apache don't have full write-access.

« previous php.notes (#90242) next »