aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
6k stars 1.21k forks source link

Fast CGI appears to crash when I update AWS SDK for PHP #2959

Closed luminajames closed 1 month ago

luminajames commented 1 month ago

Describe the bug

Hi,

I'm working on getting our EC2 instances running with IMDSv2 set to required. I found that we were using an old version of AWS SDK for PHP (Version 3.69.7) on some of our instances which was making IMDSv1 calls, so I needed to update them.

But, whenever I deploy the update, I'm getting a HTTP 500 error from IIS that says Fast CGI has encountered an error and has exited with code 0xc0000005 instead the home page of our site.

The only way I seem to be able to get it working again is if I use Git reset to revert the update and stop the instance and let EC2 recreate it.

In the PHP error logs, I did find this:

PHP Fatal error:  Call to undefined function Aws\is_valid_hostlabel() in D:\IISDATA\webroot\vendor\aws\aws-sdk-php\src\ClientResolver.php on line 877

I did search to see if anyone else had this specific issue and it seems some people run into this problem when they have the SDK installed twice. But I'm not sure how that would be the case for us, I can't see anything in composer.lock that would suggest it's installed twice. Other than that though, I can't find anything else in the logs.

Expected Behavior

The S3 and Lambda calls in my code should work.

Current Behavior

My IIS server returns 500 error messages saying Fast CGI has exited with code 0xc0000005.

Reproduction Steps

It seems I don't have this problem on my local machine. I'm not sure how best to provide a reproduction of it.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.147.7 and 3.173.19

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 5.6.38 on a Windows Server 2019 Datacenter edition (OS build: 17763.3287) machine running IIS (Version 10.0.17763.1)

GrahamCampbell commented 1 month ago

This is a known issue with using functions instead of static class methods (the functions.php file). The issue occurs when you have a version of the SDK installed globally that is older than the version you have installed locally. Guzzle mitigated this issue by migrating off of global functions. See https://github.com/guzzle/guzzle/issues/2740.

GrahamCampbell commented 1 month ago

Oh, I see you are using PHP 5.6. There is unlikely to ever be a fix for this, since AWS has ended support for PHP earlier than 7.2.5 already (https://github.com/aws/aws-sdk-php/pull/2760), and is soon to end support for PHP older than 8.1.0 (https://github.com/aws/aws-sdk-php/issues/2952).

yenfryherrerafeliz commented 1 month ago

Hi @luminajames as @GrahamCampbell said, we are not longer supporting PHP version 5.6. Would you please be able to update your PHP runtime to a most recent version or at least to 7.2.5 and by doing this, once you update the PHP SDK you will probably get the most recent version which will be more easy for us to assist you.

I look forward to your response.

Thanks!

github-actions[bot] commented 1 month ago

This issue has not recieved a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.