I have a Server Connect library file which processes a file upload where it uploads the posted file to the server and then does a Put File to a Wasabi bucket. Once done it deletes the file from the server.
This has been working for a long time but I've just found out it stopped working a few weeks ago. I've established it's the Put File component which produces the 500 error and, fortunately because it breaks, the files have been left on the server so nothing is lost. However, I need to get this fixed.
The server log says this:
mydomain.com [Fri Jun 14 16:44:28 2024] [error] [client xx.xx.43.165:0] AH01071: Got error 'PHP message: PHP Fatal error: Cannot redeclare Aws\\constantly() (previously declared in /home/sites/my/vendor/aws/aws-sdk-php/src/functions.php:20) in /home/sites/my/dmxConnectLib/aws/Aws/functions.php on line 22'
The project was still on quite old Wappler scripts until a few weeks ago when I updated everything to the latest. I wasn't aware of this break until now, though.
I'm afraid I don't have much more info I can give. I've re-published everything so the server has all the files.
Thanks for the speedy reply. I got quite excited then but I'm afraid Composer is already disabled.
Although composer is disabled, I can see the server error mentions the /vendor folder which is composer, isn't it? It must have been created some time ago and then I disabled composer but the files remained.
Topic caught my eye since I have a similar workflow, multi upload to server, convert and resize, put file(s) to Wasabi bucket, then delete from server.
I went ahead and updated to 6.7.0 and tested. Did not run into the same issue and image(s) uploaded fine. Just did the test in local development and not public test site or live site just in case it did fail.
Yes, you can delete that folder. If you then get a different error there might be a PHP composer file remaining somewhere (that tells to load everything inside vendor folder)
Thanks @Apple. I've removed the /vendor folder and also enabled, then disabled, composer and now I get this in the server error log:
mydomain.com [Fri Jun 14 18:51:49 2024] [error] [client xx.xx.43.165:0] AH01071: Got error 'PHP message: PHP Fatal error: During inheritance of Countable: Uncaught ErrorException: Return type of Aws\\HandlerList::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/sites/my/dmxConnectLib/aws/Aws/HandlerList.php:308\nStack trace:\n#0 /home/sites/my/dmxConnectLib/aws/Aws/HandlerList.php(32): exception_error_handler(8192, 'Return type of ...', '/home/sites/my/...', 308)\n#1 /home/sites/my/dmxConnectLib/aws/aws-autoloader.php(1463): require('/home/sites/my/...')\n#2 /home/sites/my/dmxConnectLib/aws/Aws/AwsClient.php(197): {closure}('Aws\\\\HandlerList')\n#3 /home/sites/my/dmxConnectLib/aws/Aws/S3/S3Client.php(328): Aws\\AwsClient->__construct(Array)\n#4 /home/sites/my/dmxConnectLib/modules/s3.php(32): Aws\\S3\\S3Client->__construct(Array)\n#5 /home/sites/my/dmxConnectLib/mod...'
I got exactly the same error after removing the vendor folder and before enabling/disabling composer in case that helps.
the file is uploaded to the server and then put in the wasabi bucket.
Probably you have some issues with old files or php packages.
Make sure Composer is enabled in your project settings and also update the PHP packages after enabling it.