dkanavis

php background&get

Jan 13th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. test.php:
  2. <?
  3.         // Put to environment variable "query string"
  4.         putenv("QUERY_STRING=arg1=".urlencode("val1&&AAaaQAA")."&arg2=".urlencode("val2&&11AAAA"));
  5.         // Run php script from shell in background, where we parse query string from env to GET array and then include file we want to exec
  6.         exec("/usr/local/bin/php -e -r 'parse_str(\$_SERVER[\"QUERY_STRING\"], \$_GET); include \"xyest.php\";' > /dev/null 2> /dev/null &");
  7. ?>
  8.  
  9.  
  10. xyest.php:
  11. <?
  12.         // Here we just test GET variable content by writing it to file and then sleep to check if script really runs in background
  13.         $f = fopen("siska", "w+");
  14.         fwrite($f, print_r($_GET, true));
  15.         sleep(10);
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment