I have a PHP script which receives an upload and defers processing of that upload to a background script via shell_exec()
.
But the background script can't seem to access the temporary file of the upload.
Receiver script
$file_loc = $_FILES['file']['tmp_name'];
echo $file_loc.' exists = '.file_exists($file_loc);
shell_exec('php background.php -i='.$file_loc.' >report.txt &');
This outputs
{path to file} exists = 1
Background.php
$args = getopt('i:');
$file_loc = $args['i'];
echo $file_loc.' exists = '.file_exists($file_loc);
In result.txt I get
{path to file} exists =
i.e. doesn't exist. What do I need to do to allow the background script to access the tmp file location?