Page 1 of 1
Using Command exec('bash -c "exec nohup setsid php -f
Posted: Sat Jun 30, 2007 4:25 am
by 1clickarticle
I got the problem here, I use exec function to run the external file.
Code: Select all
exec('bash -c "exec nohup setsid php -f test.php var=7777 > /dev/null 2>&1 &"');
It work, but it can not get the variable
var.
First time this code is work properly, but when I change the web hosting, it got this problem.
How do I fix this problem.
Please help me

Posted: Sat Jun 30, 2007 7:16 am
by feyd
How are you trying to access this "var" in test.php? (Post the file.)
Posted: Sun Jul 01, 2007 8:13 pm
by 1clickarticle
Yes I want to get the var value in test.php. But I can not get since. I think this function is work before I upgrade my hosting plan.
I don't know how to config it.
Please help
feyd wrote:How are you trying to access this "var" in test.php? (Post the file.)
Posted: Sun Jul 01, 2007 8:30 pm
by feyd
I don't think that answered by question....
Posted: Sun Jul 01, 2007 9:25 pm
by 1clickarticle
I have two file
11.php and 12.php.
11.php
Code: Select all
<?php
$tt=$_REQUEST['var'];
$fname="tt.txt";
$file=@fopen($fname,'w');
@fwrite($file, "Hell World...".$tt);
@fclose($file);
?>
12.php
Code: Select all
<?php
exec('bash -c "exec nohup setsid php -f 11.php var=7777 > /dev/null 2>&1 &"');
?>
I run 12.php in the browser, then 11.php run in background (I DO NOT run 11.php in browser), then 12.php will produce tt.txt.
in tt.txt file i want to add the var that i get from 12.php.
Result tt.txt file create, but the variable var in 12.php do not have in tt.txt.
that my problem.
Posted: Sun Jul 01, 2007 9:36 pm
by feyd
If memory serves, the data will not be in $_REQUEST. It will be in $_SERVER.
Posted: Sun Jul 01, 2007 10:04 pm
by 1clickarticle
Thank you Sir
My problem have been solved throught your answer.
Thank you BIG BIG.
