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>...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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? |
|
|||
|
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. |
|
|||
|
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. |