简体   繁体   中英

Execute php using exec() not working

I am trying to execute a shell command from php command line in following way

php -r '$test = exec("aws s3 cp s3://test/my-container/testing.txt /var/www/files-test"); echo $test;'

this works and as result files get downloaded from s3 to mentioned destination /var/www/files-test

But when I execute same command from web app it does not work. Code is

$test = exec("aws s3 cp s3://test/my-container/testing.txt /var/www/files-test");
print_r($test);

it does not work and as output I got

Completed 1 part(s) with ... file(s) remaining

I have ensured apache user has required privileges. What can be missing here?

I got this resolved, web-server I am using was nginix and web app some how was running on apache user, I gave permissions for nginix user but not for apache user!

so fix was to get back the app to run on nginix user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM