Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP running in background + GET variables

Status
Not open for further replies.

commun1

Programmer
May 26, 2004
41
DE
Heya,

I wanna execute a script in the background.


Code:
exec('/usr/local/bin/php /[URL unfurl="true"]www/htdocs/test/test.php?string=test1[/URL] > /[URL unfurl="true"]www/htdocs/test/test.html[/URL] &');


test.php just consists of a var named $string, however the exec command does not pass the value "test1" for $string like it does with http GET-vars.

I need some values passed to the test.php-script which should be processed in the background.

any ideas?
 
is this the linux's exec command?

you should use lynx instead of php directly...
 
Where are you running this from? Inside a PHP script?
COmmand line syntax is different from URLs. You can;t just append parameters like that.

I recommend to call the script with either an Apache subrequest (need PHP as a mod) or a socket or cURL operation. Then you can execute it in the background and save the result into a flat file.
 
i need to run it through a php script called via http.
I'm on virtual hosting so root access is not available, however safe mode is OFF so I am able to use exec().

actually, there is a user who surfs within a webpage and executes the script I want to be in the background so the surfing doesn't get interrupted.

there is user sensitive data I need to pass to that script, e.g.

...

in this example I'd need test1,test2,test3 to be used by the exec command I posted in the first thread.

Will look into $argc and $argv...

cURL seems quite complex for my intention...
 
hi,
if you are using the command line PHP, the _GET variable will no be available, that's because this is a HTTP variable.
In command line execution you shod use the $argv variable

like:
Code:
print_r($argv);

Regards,
Marcel

___
____
 
If the URL file wrappers are enabled file_get_contents() with a http:// will execute the script. No cURL necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top