problem with Exec() on WinXP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DemonSpawn
Forum Newbie
Posts: 1
Joined: Tue Jul 22, 2003 10:28 am

problem with Exec() on WinXP

Post 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
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post 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()
Post Reply