Re: where does exec look for the program?
| From: | Daniel Rezny | Date: | Wed, 11 Oct 2000 19:12:40 +0000 |
| Subject: | Re: where does exec look for the program? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19673@lists.php.net to get a copy of this message | ||
Hello Rich,
Wednesday, October 11, 2000, 8:07:06 PM, you wrote:
RP> Hello, this is my first time on this list, so be gentle. I am also new to
RP> PHP.
RP> I have compiled a small c program called regkey, which computes a key.
RP> I have it installed in my cgi-bin of my webserver It is marked as
RP> executable (755), and it runs correctly from a telnet session.
RP> I am trying to exec it from a php file. the code below always fails with a
RP> code of 2, or file not found.
RP> <?php
RP> // compute new key
RP> $cmdline = "\"$fullname\" . \"Micro-Magic\" .
RP> \"$SerialNo" ;
RP> $RegKey = exec("/home/umagic/cgi-bin/regkey $cmdline", $msgs,$rc) ;
?>>
RP> I have heard that you can only exec things in the apache path. Is there a
RP> way to work around this? the following works:
RP> $RegKey = exec("ls -d", $msgs,$rc) ;
RP> regards,
RP> Rich Peters
Do you have php compiled as cgi to apache?
$cmdline = "\"$fullname\" . \"Micro-Magic\" .
\"$SerialNo\"";
$RegKey = exec("/home/umagic/cgi-bin/regkey $cmdline", $msgs,$rc);
try this
With last quote in the and of line 1
--
Best regards,
Daniel mailto:daniel@mail.viapvt.sk