0

I'm not enable to locate credential files on my shared host. the credential location for all hosted domains are same. the second way to set access keys is to use env var but I'm not allowed to set environment variable over putenv() to! the putenv() has been disabled by admin.

I'm looking for a solution, like bringing my access and secret keys into my code and passing them to S3Client.

Any help?

MESepehr
  • 758
  • 6
  • 19
  • For non-EC2 instances, the traditional method for storing credentials is to run the [AWS Command-Line Interface (CLI)](http://aws.amazon.com/cli/) `aws configure` command and provide credentials. This will store the information in `~/.aws/credentials`. Any code that uses an AWS SDK will find and use those credentials. – John Rotenstein Apr 08 '22 at 02:38
  • 1
    You _can_ use [hard coded credentials](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_hardcoded.html). The standard caveats about using such things apply, perhaps more so on a shared host where other users can see your source code, and thus credentials, and if any failure causes php documents to be sent to clients, that will include credentials in the clear. – Anon Coward Apr 08 '22 at 03:08
  • @AnonCoward Thanks! I didn't see this document, and also when I had tried that earlier, I forgot to remove 'profile' => 'default' line which makes aws to seek for the credential file anyway. – MESepehr Apr 08 '22 at 06:13

0 Answers0