I am working with the AWS S3 SDK for PHP on localhost (WAMP) and it works fine.
Add. information: Works fine after installing .aws folder with global and credentials files in my local userprofile and in the project.
Fatal error: Uncaught Aws\Exception\CredentialsException: Error retrieving credentials from the instance profile metadata server.
Transfering the complete project to a ,provider managed webspace it does not find credentials. It only works with hard coded credentials, but risk is in my point of view too high lossing control of this data.
Example from AWS documenatation for bucket listing.
require 'aws-autoloader.php'; use Aws\S3\S3Client;
Does NOT work in this way:
$s3Client = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'eu-central-1'
]);
Works in this way:
$s3Client = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'eu-central-1',
'credentials' => [
'key' => "THE_KEY",
'secret' => "THE_SECRET"
]]
);
The root of my webserver: /var/www/vhosts/my-webspace/my-subdomain
The root of my project: /var/www/vhosts/my-webspace/my-subdomain/folder1/folder2
The folders:
the application script and autoloader are stored in folder2, .Aws also in the webservers root (see above). I tried to copy the .Aws folder also in the webservers root folder, no success.
Exist a setting in the webservers php.ini that must be set (if possible on a providor managed webspace)?