I have this small php code
$command = 'bash newpdftoebook.bash ' . $_POST['BookID'] . ' "' . $_POST['pdffile'] . '"';
$descriptorspec = array(
// stdin is a pipe that the child will read from
0 => array("pipe", "r"),
// stdout is a pipe that the child will write to
1 => array("pipe", "w"),
// stderr is a pipe that the child will write to
2 => array("pipe", "w")
);
flush();
$process = proc_open($command, $descriptorspec, $pipes, realpath('./'), array());
And this is my bash file
dirhome=/var/www/html/
dirprocessing=$dirhome"processing/"
if [ ! -d "$dirprocessing" ]; then
echo -e "Error: there is no folder 'processing'"
fi
pdffile=$dirprocessing"action-"$1".pdf"
if [ ! -f "$pdffile" ]; then
#clear dirftp
rmdir=$dirprocessing"*"
rm -R $rmdir
#copy from google drive to local ubuntu server *.pdf
wget -O $dirprocessing"action-$1.pdf" "$2"
fi
It is not downloading the file, but when i execute it within the terminal the file is downloaded successfully. I am running this inside my terminal
bash /var/www/html/newpdftoebook.bash 2569 "http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf"
What i am doing wrong, btw this code was working fine before that, but i installed a new Ubuntu 18 machine and moved the code there and since then the code dosent work anymore. Also i have installed wget on the machine as i have test it and it is working from terminal.