Re: passthru() passing variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I dunno what 127 actually means, but the last time we saw it on this list,
it boiled down to:

"You can't even run your 'sh' shell, much less Perl in that shell."

Check what's in /bin/sh and what its permissions are.

Make sure it's actually a valid shell binary, and not something bogus.

If that's not it, keep digging.

Somewhere, somehow, you've got something in permissions that is not
allowing you to run a process/binary you need.

If it's not /bin/sh, look at Perl.
If it's not Perl, check your permissions on test.cgi again.

Remember that PHP does not run as "you" with all your permissions - If you
can 'su' to the user PHP runs as, this could get a lot easier to test...

Check httpd.conf "User" directive to be certain you know what user PHP
runs as, or check <?php phpinfo()?> output.

On Thu, June 16, 2005 11:55 am, Chris Herold said:
> I'm sorry, when I do the exec() */properly/ *I get
>
> OS Error: 127
> Content-type: text/html
>
> Source ID:
>
> Richard Lynch wrote:
>
>>On Wed, June 15, 2005 5:36 pm, Chris Herold said:
>>
>>
>>>I have been told that in order to pass variables via passthru() to
>>>another script (in my case, a perl script) one can do the following ...
>>>
>>>passthru("home/test.cgi $var")
>>>
>>>and that $var will then be passed through to the cgi.
>>>
>>>I have tried this and failed.
>>>
>>>Is this the proper format or is there something that I am missing.
>>>
>>>
>>
>>You may want to use exec first, so you can more easily capture the error
>>output and error codes.
>>
>>exec("home/test.cgi $var", $output, $error);
>>if ($error){
>>  //You should probably use error_log here in your real code...
>>  //ASSUME this is going to break some day, for whatever reason.
>>  //You'll need it logged unless you like dealing with error reports
>> like:
>>  //"Hey, the website broke yesterday."
>>  echo "OS Error:  $error<br />\n";
>>  echo implode("<br />", $output);
>>  exit;
>>}
>>echo $output;
>>
>>Meanwhile, odds are *REALLY* good that you're not even calling the
>>test.cgi script because you haven't provide a path that PHP can use.
>>
>>home/test.cgi would be assuming that home was in the same directory as
>>your PHP script, and even that is kinda iffy depending on where you do
>>this from the webserver or CLI...
>>
>>I would recommend using FULL PATH to *everything* in exec (and passthru)
>>
>>/full/path/to/home/test.cgi /full/path/to/any/args.txt
>>
>>Also be sure to use the escapeshellargs function to make your $var data
>>kosher if it comes from the outside world.
>>
>>
>>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux