Page 1 of 1

problem with Exec() on WinXP

Posted: Tue Jul 22, 2003 10:28 am
by DemonSpawn
Hi

Im not sure if this is a problem with php or apache but if someone could give me a sollution to my problem Id be eternaly gratefull. Im building a webbased adminstration page for editting htaccess files and adding usere on the fly, but when I execute the following script I get a error message in the apache log. The command it self seems to be working fine but for some reason it fails to create a temp version of the file

SCRIPT:

Code: Select all

$cmd = "C:\\progra~1\\apache~1\\Apache2\\bin\\htpasswd.exe";
$pwfile = "C:\\progra~1\\apache~1\\Apache2\\htdocs\\subdomain.domain.com\\htpasswd";
$user = "test";
$passwd = "test";
$cmdline = "$cmd -c -b $pwfile $user $passwd";

// print "$cmdline<BR><BR>\n\n";

exec($cmdline, $AllOutput, $ReturnValue);
ERROR:

Code: Select all

&#1111;Tue Jul 08 00:48:46 2003] &#1111;error] &#1111;client ---.---.---.---] Automatically using MD5 format.
&#1111;Tue Jul 08 00:48:46 2003] &#1111;error] &#1111;client ---.---.---.---] C:\progra~1\apache~1\Apache2\bin\htpasswd.exe: unable to create temporary file \/htpasswd.tmp.44MLDm
what have I missed ?

I use the following:
Windows XP
PHP 4.2.3
Apache 2.0.44

Posted: Tue Jul 22, 2003 2:01 pm
by Stoker
permission problem? The user that apache runs as does not have execute permission on htpasswd?

Or if the username or password used contains spaces or funny stuff it could cause errors.. use escapeshellarg()