Re: [PHP] Capturing output of shell script.

2001-07-02 Thread Charles Williams


- Original Message -
From: Brad Hubbard [EMAIL PROTECTED]
To: Charles Williams [EMAIL PROTECTED];
Php-General (E-mail) [EMAIL PROTECTED]
Sent: Saturday, June 30, 2001 1:12 PM
Subject: Re: [PHP] Capturing output of shell script.


 On Sat, 30 Jun 2001 06:36, Charles Williams wrote:
  Hello all,
 
  I have an .sh shell script being executed from a php4 call.  I need to
  capture the string return and work with that in the php script.  The
only
  problem is that the call works but I cannot get the returned string.
I've
  tried using exec, passthru, ``, system, and escapeshellcommand.  Nothing
  seems to work.  any ideas?

 $capture = `script.sh 21`; // redirect standard error to standard output


 Cheers,
 Brad

Brad,

Here is what I am trying to execute:

$pass_string = super cadduser -f \.$full_name.\ -u
\.$Username.\ -p \.$Password.\ -q \.$Quota.\ -x -d
.$top_domain;
exec($pass_string, $ary_result);
echo Result: ;
#var_dump($ary_result);
return $ary_result;

For some reason it will only continue execution past the 'exec' call rarely.
Most of the time the script just stops after the exec call (the echo and
below is not executed).  When it does go beyond the 'exec' call the var_dump
(that I use for testing only. will be gone when working) does show as an
array.

I have the max_execution_time set to 180 so I know the script isn't timeing
out.  Any ideas?  I have never run into this problem before.

thanks
chuck



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Capturing output of shell script.

2001-07-02 Thread Charles Williams

correction below

chuck

- Original Message -
From: Charles Williams [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Php-General (E-mail)
[EMAIL PROTECTED]
Sent: Monday, July 02, 2001 10:54 PM
Subject: Re: [PHP] Capturing output of shell script.



 - Original Message -
 From: Brad Hubbard [EMAIL PROTECTED]
 To: Charles Williams [EMAIL PROTECTED];
 Php-General (E-mail) [EMAIL PROTECTED]
 Sent: Saturday, June 30, 2001 1:12 PM
 Subject: Re: [PHP] Capturing output of shell script.


  On Sat, 30 Jun 2001 06:36, Charles Williams wrote:
   Hello all,
  
   I have an .sh shell script being executed from a php4 call.  I need to
   capture the string return and work with that in the php script.  The
 only
   problem is that the call works but I cannot get the returned string.
 I've
   tried using exec, passthru, ``, system, and escapeshellcommand.
Nothing
   seems to work.  any ideas?
 
  $capture = `script.sh 21`; // redirect standard error to standard
output
 
 
  Cheers,
  Brad

 Brad,

 Here is what I am trying to execute:

 $pass_string = super cadduser -f \.$full_name.\ -u
 \.$Username.\ -p \.$Password.\ -q \.$Quota.\ -x -d
 .$top_domain;

The above should be one line.


 exec($pass_string, $ary_result);
 echo Result: ;
 #var_dump($ary_result);
 return $ary_result;

 For some reason it will only continue execution past the 'exec' call
rarely.
 Most of the time the script just stops after the exec call (the echo and
 below is not executed).  When it does go beyond the 'exec' call the
var_dump
 (that I use for testing only. will be gone when working) does show as an
 array.

 I have the max_execution_time set to 180 so I know the script isn't
timeing
 out.  Any ideas?  I have never run into this problem before.

 thanks
 chuck



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Capturing output of shell script.

2001-06-30 Thread Don Read


On 29-Jun-01 Charles Williams wrote:
 Hello all,
 
 I have an .sh shell script being executed from a php4 call.  I need to
 capture the string return and work with that in the php script.  The only
 problem is that the call works but I cannot get the returned string.  I've
 tried using exec, passthru, ``, system, and escapeshellcommand.  Nothing
 seems to work.  any ideas?

$cmd='stuff.sh';
$p=popen($cmd, 'r');
if ($p) {
   while ($str=fgetss($p,1000)) {
 do_foo($str);
   }
   pclose($p);
} else {
   echo Pphsst. bad command: $cmd BR;
}

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Capturing output of shell script.

2001-06-30 Thread Brad Hubbard

On Sat, 30 Jun 2001 06:36, Charles Williams wrote:
 Hello all,

 I have an .sh shell script being executed from a php4 call.  I need to
 capture the string return and work with that in the php script.  The only
 problem is that the call works but I cannot get the returned string.  I've
 tried using exec, passthru, ``, system, and escapeshellcommand.  Nothing
 seems to work.  any ideas?

$capture = `script.sh 21`; // redirect standard error to standard output


Cheers,
Brad
-- 
Brad Hubbard
Congo Systems
12 Northgate Drive,
Thomastown, Victoria, Australia 3074
Email: [EMAIL PROTECTED]
Ph: +61-3-94645981
Fax: +61-3-94645982
Mob: +61-419107559

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]