I have a scrapy spider configured to fetch data from some sites. and i have developed a ui in php and html to show scraped data.this data is being fetched from json file being generated upon running scrapy command. iam using ampps for running php. initally my php code look like following
$output= shell_exec('cd /home/testuser/Desktop/scrapy_tutorial/ && scrapy crawl example -o example.json 2>&1');
print_r($output);
and i got result as 'scrapy command not found'.so i changed my code to set full path of scrapy bin
$output= shell_exec('cd /home/testuser/Desktop/scrapy_tutorial/ && /usr/local/bin/scrapy crawl example -o example.json 2>&1');
print_r($output);
now iam getting output which contains message
PermissionError: [Errno 13] Permission denied: 'example.json'
looks like crawler works fine but has no permissions for writing to file.
i checked user which executes php script using
exec('whoami');
and it outputs 'ampps'
Any help will be appreciated.