hi ... any one familiar with ancient php/fi 2.0.1
i have a bunch of ubnt nanostations M series (wireless access points/routers)... they use airOS (a fork of openwrt). it runs a custom firmware that i made using provided sdk. and the lighttpd uses php/fi 2.0.1.... this is (of course) used to serve the web configuration.
the problem: i need to use the ($) in a string but i couldn't. what i need to do is download some file from the internet using wget and have the pid of wget back to keep track of the process, then parse the output to the page:
Code:
$cmd = "wget $FileToDownload -O $file > $wget_log 2>&1 & echo \$!";
$pid = exec($cmd);
echo $pid;
what i get from the last echo is (\$!) not the pid. i trid removing the escape (\) then i get only (!). i also tried
Code:
"wget $FileToDownload -O $file > $wget_log 2>&1 & echo " + '$!'
then i get 36... the dot (.) operator between two string produces parse error!! e.g. "...echo ".'$!'
running the command from the terminal gives correct pid... tried manually putting the download part in a file and running it from php and it worked when i do some thing like:
Code:
$pid = exec("/tmp/download.sh")
echo $pid
but the proble with this is the same, can't write the script from php (same $ problem) and can't use a permanent one cause the file to download will change periodically
any ideas??!!
regards