개발
Laravel 개발 일지
라라벨에서 AWS SDK를 설치했을때 나오는 PHP 버전 에러 우회 방법
163 views as of October 10, 2024.
라라벨 프로젝트에 AWS SDK를 설치하니 기존에 S3 Storage를 쓰던곳에서 아래와 같은 에러 메시지가 나왔다.

1
2
3
4
This installation of the SDK is using PHP version 7.2.34, which will be deprecated on January 13th, 2025.
Please upgrade your PHP version to a minimum of 8.1.x to continue receiving updates for the AWS SDK for PHP.
To disable this warning, set suppress_php_deprecation_warning to true on the client constructor or set the environment variable AWS_SUPPRESS_PHP_DEPRECATION_WARNING to true.
More information can be found at: https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-php-runtimes-8-0-x-and-below-in-the-aws-sdk-for-php/
cs


뭐 쉽게말하면 AWS-SDK-PHP가 현재 운용중인 php 버전과 자신들의 sdk 버전에서 필요한 php 버전이 차이가 나니 그부분을 메꾸라는 에러메시지이다.

근데문제는 라이브 서비스중인 환경에서는 이런 버전업은 많이 힘들다...

어찌저찌 저 에러를 우회할 수 있는 방법이 있나 알아보니 s3 설정에 아래와 같은 옵션을 껴넣으면 된다고한다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'disks' => [
    ...
 
 
    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
        'endpoint' => env('AWS_ENDPOINT'),
        'suppress_php_deprecation_warning' => env('AWS_SUPPRESS_PHP_DEPRECATION_WARNING'true),
    ],
],
 
cs

config/filesystems.phps3 설정 맨 아랫줄에 아래와 같은 구문을 추가해준다.

'suppress_php_deprecation_warning' => env('AWS_SUPPRESS_PHP_DEPRECATION_WARNING', true)

이후 .env 파일에도 아래와 같은 구문을 추가해준다.

AWS_SUPPRESS_PHP_DEPRECATION_WARNING=true

그러면 위와 같은 에러는 안뜰것이다.
×