When I execute
s3cmd put --acl-public --guess-mime-type /html/file.png s3://bucket/files/file.png
via cmd in putty it works perfectly, h开发者_高级运维owever when I attempt to execute this via PHP :
system("s3cmd put --acl-public --guess-mime-type /html/file.png s3://bucket/files/file.png");
nothing happens. Does anyone have an idea of why it is not working? Do I have to modify a setting in php.ini or am I doing something wrong?
I'll second the recommendation to look at the Apache log file, but I'll wager that this is a permissions issue (I've had that problem...). Does Apache (httpd?) have read/write access to /html/file.png
and s3://bucket/files/file.png
? Does s3cmd require special permissions? Do you need to use gksudo?
The s3cmd looks in a users home directory for the .s3cfg
file. In your case, apache is probably the user running the program and apache doesn't have a .s3cfg
file.
You need to run this again as the user that you intend to use s3cmd with.
/usr/bin/s3cmd --configure
There's maybe so restriction on the system command, you should try to look in the error_log, increase the error_reporting level or disable the safe_mode in php.ini
there is some issue executing s3cmd from a php file (apache user) s3cmd can't find the s3cfg file, i put it in the command a it work:
s3cmd -c /var/www/.s3cfg put file...
精彩评论