By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,871 Members | 2,418 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,871 IT Pros & Developers. It's quick & easy.

why can not get the correct return value?

P: n/a
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
Dec 12 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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.
Dec 12 '07 #2

P: n/a
On Wed, 12 Dec 2007 15:35:37 +0100, ZeldorBlat <ze********@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
Dec 12 '07 #3

P: n/a
On 12月12日, 下午10时45分, "Rik Wasmus" <luiheidsgoe....@hotmail.comwrote:
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
Dec 13 '07 #4

P: n/a
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?
Dec 13 '07 #5

P: n/a
On Dec 12, 9:45 am, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
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.
Dec 13 '07 #6

P: n/a
On 12月13日, 下午9时29分, Captain Paralytic <paul_laut...@yahoo.comwrote:
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.
Dec 14 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.