R: [PHP-WIN] PHP, apache, function exec(), stdin and pgp

From: Date: Fri, 04 Aug 2000 12:51:55 +0000
Subject: R: [PHP-WIN] PHP, apache, function exec(), stdin and pgp
Groups: php.windows 
Request: Send a blank email to php-windows+get-1552@lists.php.net to get a copy of this message
>Hi everybody, >sorry to bug You with my bugs, but I have this situation > >I'm running PHP 4.0.1 pl2 on Apache server 1.3.12 on w2k > >now my problem is that I need to run external program pgpe >to sign email which is sent to user, but the pgpe is waiting >for password - since there's no parameter to input it thru >command line I want to pass it thru standard input (There's >similar example in PGP docs for C/C++) >This is the code: > >exec("pgpe -r liv -s text.txt -at -o enctext.txt"); > >$fstdi=fopen("php://stdin"); > >if (!$fstdi) > { > echo "Could not open file."; > } >else > { > fwrite($fstdi,"password\n"); > } > >but the page always hang out. >Is there some library for pgp? > >Thanks for any help > >Bye Petr Chocholac petr@k2ia.com > hello Petr, your question is very interesting but I have only some advices to give you.. are you sure your code is exactly as you stated before? where did you find the syntax $fstdi=fopen("php://stdin"); ? (it lacks at least the opening mode parameter..) I think the problem maybe that the exec() function waits until the application ends, so you can't then write to stdin (if even it's possible..? is there a "global" standard input on windows or many application-local stdin-s? I don't know..) I made some tests and found a way to exec() an application from php and avoid waiting its end (wrote a simple program with Centura TDeveloper), but still couldn't write to stdin.. hope this helps, bye, Giuse PS when you execute the script, did you get the pgpe command (DOS like) window? if not surely you can't write to its stdin.. PS2 some other tests: it seems I can only exec() windows-GUI-interface application ; the only not-GUI app. that works is cmd.exe (windows shell) via my Centura program , but didn't get to pass an argument to it and make it exec another app. .. PS3 I'm on win NT 4 sp5 , apache 1.3.12, php4.0.0 & 4.0.1pl2

« previous php.windows (#1552) next »