command line - 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");

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.

People are also looking for solutions to the problem: wordpress - PHP Make an $ function to an link with an get function


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.