Re[2]: [PHP] where does exec look for the program?
| From: | Daniel Rezny | Date: | Wed, 11 Oct 2000 19:30:56 +0000 |
| Subject: | Re[2]: [PHP] where does exec look for the program? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19684@lists.php.net to get a copy of this message | ||
Hello Rich,
Wednesday, October 11, 2000, 9:24:11 PM, you wrote:
RP> Return-Path: php-general-return-19679-daniel=mail.viapvt.sk@lists.php.net
RP> Received: from toye.php.net (sourceforge.net [198.186.203.33])
RP> by kamzik.pvt.sk (8.11.0/8.9.3) with SMTP id e9BJNmc83662
RP> for <daniel@mail.viapvt.sk>; Wed, 11 Oct 2000 21:23:48 +0200 (CEST)
RP> Received: (qmail 16724 invoked by uid 1013); 11 Oct 2000 19:23:48 -0000
RP> Mailing-List: contact php-general-help@lists.php.net; run by ezmlm
RP> Precedence: bulk
RP> list-help: <mailto:php-general-help@lists.php.net>
RP> list-unsubscribe:
RP> <mailto:php-general-unsubscribe@lists.php.net>
RP> list-post: <mailto:php-general@lists.php.net>
RP> Delivered-To: mailing list php-general@lists.php.net
RP> Received: (qmail 16718 invoked from network); 11 Oct 2000 19:23:48 -0000
RP> Message-ID: <036301c033b8$d5b21230$fa6929d0@rp>
RP> Reply-To: "Rich Peters" <rpeters@micro-magic.com>
RP> From: "Rich Peters" <rpeters@micro-magic.com>
RP> To: <php-general@lists.php.net>
RP> References: <NEBBJJOBDDCGOCOGAJGGEEEPCGAA.rmccluskey@incubanks.com>
RP> <Pine.GSO.4.21.0010111051380.21695-100000@beatrice.kefta.com>
RP> <20001011135801.B30979@MageNet.com>
RP> <029b01c033ae$14ceff10$fa6929d0@rp> <1633263665.20001011211240@mail.viapvt.sk>
RP> Date: Wed, 11 Oct 2000 12:24:11 -0700
RP> Organization: Micro-Magic
RP> MIME-Version: 1.0
RP> Content-Type: text/plain;
RP> charset="iso-8859-1"
RP> Content-Transfer-Encoding: 7bit
RP> X-Priority: 3
RP> X-MSMail-Priority: Normal
RP> X-Mailer: Microsoft Outlook Express 5.50.4133.2400
RP> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
RP> Subject: Re: [PHP] where does exec look for the program?
RP> X-UIDL: dc2fff08b1d8a395245da0c88f8cdafb
RP> Daniel,
RP> the web server is using php_mod, so its not compiled as cgi
RP> I tried what you suggested, with a slight mod to make it parse:
RP> $cmdline = "\"$fullname\" . \"Micro-Magic\" .
RP> \"$SerialNo" ;
RP> $RegKey = exec("/home/umagic/cgi-bin/regkey \"$cmdline\"",
RP> $msgs,$rc) ;
RP> Its still not finding regkey to execute. Its never getting to the command
RP> line.
RP> regards,
RP> Rich Peters
RP> Micro-Magic
RP> ----- Original Message -----
RP> From: "Daniel Rezny" <daniel@mail.viapvt.sk>
RP> To: "Rich Peters" <rpeters@micro-magic.com>; "php-list"
RP> <php-general@lists.php.net>
RP> Sent: Wednesday, October 11, 2000 12:12 PM
RP> Subject: Re: [PHP] where does exec look for the program?
>> 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
RP> 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
RP> 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> ;
>> ?>>
>>
>> RP> I have heard that you can only exec things in the apache path. Is
RP> 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
>>
>>
Do you have corect sets a cgi-bin directory in httpd.conf?
in my conf file is
ScriptAlias /cgi-bin/ /home/httpd/html/cgi-bin/
and please try to call this only as cgi-bin/reg-key $cmdline.
--
Best regards,
Daniel mailto:daniel@mail.viapvt.sk