Monday, 15 June 2015

amazon s3 - Running S3cmd from PHP Script not working -



amazon s3 - Running S3cmd from PHP Script not working -

i want utilize s3cmd php script. working shell same not working php script.

shell_exec('s3cmd --config=/root/s3cmd.conf ls');

this not working, , gave total path s3cmd installation

shell_exec('/usr/sbin/s3cmd --config=/root/s3cmd.conf ls');

not working in php script same working in command,

the php file calling shell_exec in webroot.

might problem s3cmd configured root user , running php www-data. if problem how can create config file www-data.

help me doing wrong.

thanks

edit using s3cmd. run commands in cron script. cron script php script. user running cron web11 , s3cmd configured using root user.

so when run s3cmd using shell_exec() in php script fails. when run in shell works fine.

s3cmd ls

this works fine. login using root user.

i tried run using runuser command

runuser -l root -c "s3cmd ls"

this works fine , displays list of buckets. when run using

runuser -l root -c "s3cmd ls"

this not work. tried giving total path of s3cmd

/usr/bin/s3cmd ls

this works in shell not in php script.

i changed permissions 777 php script , made root owner of user. still not work.

how can run s3cmd php script. ? on amazon ec2 instance.

why not utilize aws sdk php? can have same functionality using s3client.listobjects() method

amazon-s3 s3cmd

No comments:

Post a Comment