why can not get the correct return value?

This is a discussion on why can not get the correct return value? within the PHP Language forums, part of the PHP Programming Forums category; Hello I run a simple php file as: <?php $result=system("atq",$parameter); echo '<br>...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-12-2007
luo.fengkui@gmail.com
 
Posts: n/a
Default why can not get the correct return value?

Hello
I run a simple php file as:
<?php
$result=system("atq",$parameter);
echo '<br>result='.$result;
echo '<br>parameter='.$parameter;
//phpinfo();
?>

run it on command line can get the parameter value as 0,but if use
browser to run it,the parameter value is 1,Why?
Note:I had set the user and group in httpd.conf.if change as
$result=system("ls",$parameter);,then can get the parameter value as 0
Reply With Quote
  #2 (permalink)  
Old 12-12-2007
ZeldorBlat
 
Posts: n/a
Default Re: why can not get the correct return value?

On Dec 12, 7:15 am, luo.feng...@gmail.com wrote:
> Hello
> I run a simple php file as:
> <?php
> $result=system("atq",$parameter);
> echo '<br>result='.$result;
> echo '<br>parameter='.$parameter;
> //phpinfo();
> ?>
>
> run it on command line can get the parameter value as 0,but if use
> browser to run it,the parameter value is 1,Why?
> Note:I had set the user and group in httpd.conf.if change as
> $result=system("ls",$parameter);,then can get the parameter value as 0


Since you haven't set the value of $parameter anywhere I'm not sure
why you'd expect it have any particular value.
Reply With Quote
  #3 (permalink)  
Old 12-12-2007
Rik Wasmus
 
Posts: n/a
Default Re: why can not get the correct return value?

On Wed, 12 Dec 2007 15:35:37 +0100, ZeldorBlat <zeldorblat@gmail.com>
wrote:

> On Dec 12, 7:15 am, luo.feng...@gmail.com wrote:
>> Hello
>> I run a simple php file as:
>> <?php
>> $result=system("atq",$parameter);
>> echo '<br>result='.$result;
>> echo '<br>parameter='.$parameter;
>> //phpinfo();
>> ?>
>>
>> run it on command line can get the parameter value as 0,but if use
>> browser to run it,the parameter value is 1,Why?
>> Note:I had set the user and group in httpd.conf.if change as
>> $result=system("ls",$parameter);,then can get the parameter value as 0

>
> Since you haven't set the value of $parameter anywhere I'm not sure
> why you'd expect it have any particular value.


It's called a reference...
http://www.php.net/system
--
Rik Wasmus
Reply With Quote
  #4 (permalink)  
Old 12-13-2007
luo.fengkui@gmail.com
 
Posts: n/a
Default Re: why can not get the correct return value?

On 12月12日, 下午10时45分, "Rik Wasmus" <luiheidsgoe....@hotmail.com> wrote:
> On Wed, 12 Dec 2007 15:35:37 +0100, ZeldorBlat <zeldorb...@gmail.com>
> wrote:
>
>
>
> > On Dec 12, 7:15 am, luo.feng...@gmail.com wrote:
> >> Hello
> >> I run a simple php file as:
> >> <?php
> >> $result=system("atq",$parameter);
> >> echo '<br>result='.$result;
> >> echo '<br>parameter='.$parameter;
> >> //phpinfo();
> >> ?>

>
> >> run it on command line can get the parameter value as 0,but if use
> >> browser to run it,the parameter value is 1,Why?
> >> Note:I had set the user and group in httpd.conf.if change as
> >> $result=system("ls",$parameter);,then can get the parameter value as 0

>
> > Since you haven't set the value of $parameter anywhere I'm not sure
> > why you'd expect it have any particular value.

>
> It's called a reference...http://www.php.net/system
> --
> Rik Wasmus


I has checked it,but it is a pity,still can not get the expected
result.I had modified the httpd.conf,php.ini,sudoers,at.allow
Reply With Quote
  #5 (permalink)  
Old 12-13-2007
Captain Paralytic
 
Posts: n/a
Default Re: why can not get the correct return value?

On 12 Dec, 12:15, luo.feng...@gmail.com wrote:
> Hello
> I run a simple php file as:
> <?php
> $result=system("atq",$parameter);
> echo '<br>result='.$result;
> echo '<br>parameter='.$parameter;
> //phpinfo();
> ?>
>
> run it on command line can get the parameter value as 0,but if use
> browser to run it,the parameter value is 1,Why?
> Note:I had set the user and group in httpd.conf.if change as
> $result=system("ls",$parameter);,then can get the parameter value as 0


When run on the command line, it is running under the userid that you
are logged in with.
When run from a browser, the web server (apache?) is running it under
its userid. Possibly this latter userid does not have the correct
authority?
Reply With Quote
  #6 (permalink)  
Old 12-13-2007
ZeldorBlat
 
Posts: n/a
Default Re: why can not get the correct return value?

On Dec 12, 9:45 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 12 Dec 2007 15:35:37 +0100, ZeldorBlat <zeldorb...@gmail.com>
> wrote:
>
>
>
> > On Dec 12, 7:15 am, luo.feng...@gmail.com wrote:
> >> Hello
> >> I run a simple php file as:
> >> <?php
> >> $result=system("atq",$parameter);
> >> echo '<br>result='.$result;
> >> echo '<br>parameter='.$parameter;
> >> //phpinfo();
> >> ?>

>
> >> run it on command line can get the parameter value as 0,but if use
> >> browser to run it,the parameter value is 1,Why?
> >> Note:I had set the user and group in httpd.conf.if change as
> >> $result=system("ls",$parameter);,then can get the parameter value as 0

>
> > Since you haven't set the value of $parameter anywhere I'm not sure
> > why you'd expect it have any particular value.

>
> It's called a reference...http://www.php.net/system
> --
> Rik Wasmus


Doh! Thanks, Rik.
Reply With Quote
  #7 (permalink)  
Old 12-14-2007
luo.fengkui@gmail.com
 
Posts: n/a
Default Re: why can not get the correct return value?

On 12月13日, 下午9时29分, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 12 Dec, 12:15, luo.feng...@gmail.com wrote:
>
> > Hello
> > I run a simple php file as:
> > <?php
> > $result=system("atq",$parameter);
> > echo '<br>result='.$result;
> > echo '<br>parameter='.$parameter;
> > //phpinfo();
> > ?>

>
> > run it on command line can get the parameter value as 0,but if use
> > browser to run it,the parameter value is 1,Why?
> > Note:I had set the user and group in httpd.conf.if change as
> > $result=system("ls",$parameter);,then can get the parameter value as 0

>
> When run on the command line, it is running under the userid that you
> are logged in with.
> When run from a browser, the web server (apache?) is running it under
> its userid. Possibly this latter userid does not have the correct
> authority?


Yes,I know your meaning,My web server is apache,I had changed the user
and group as Test_bench,thse user that I logged in Linux is Test_bench
too,so,I don't think this issue is about User Setting.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:38 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0