Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.1 & XF 2.2

Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.1 & XF 2.2

No permission to download
Ok. It’s hard to know what’s causing it without more information.

Try enabling debug mode to see if you get a more detailed error message on screen or in your admin CP error log.

Also check your server’s web server and/or PHP error logs for more information.
 
I managed to find the problem with my configuration. Snuffleupagus was blocking the http/https PHP streams. Adding that to the whitelist fixed my issues of the internal_data not working.
 
Ok. It’s hard to know what’s causing it without more information.

Try enabling debug mode to see if you get a more detailed error message on screen or in your admin CP error log.

Also check your server’s web server and/or PHP error logs for more information.
I'm adding the debug enable code to the Xenforo config and it's producing a 500 error as well.

Code:
PHP:  
$config['debug']=true;

I also tried OzzModz debug plugin and that works, but when uncommented the S3 code in config it produces the 500 error.

I tracked down an error in the logs which looks like it might be the issue, though I can't decipher it.

Code:
[Fri Jan 03 11:17:52.595380 2025] [proxy_fcgi:error] [pid 1936626:tid 1936626] [client 216.244.66.246:0] AH01071: Got error 'PHP message: PHP Fatal error:  Label 'PHP' already defined in /home/domain/web/domain.org/public_html/forums/src/config.php on line 31; PHP message: PHP Fatal error:  Uncaught Error: Attempted to recursively load configuration file in /home/domain/web/domain.org/public_html/forums/src/XF/App.php:261\nStack trace:\n#0 /home/domain/web/domain.org/public_html/forums/src/XF/Container.php(33): XF\\App->XF\\{closure}(Object(XF\\Container))\n#1 /home/domain/web/domain.org/public_html/forums/src/XF/App.php(760): XF\\Container->offsetGet('...')\n#2 /home/domain/web/domain.org/public_html/forums/src/XF/Container.php(33): XF\\App->XF\\{closure}(Object(XF\\Container))\n#3 /home/domain/web/domain.org/public_html/forums/src/XF/App.php(2983): XF\\Container->offsetGet('...')\n#4 /home/domain/web/domain.org/public_html/forums/src/XF/Error.php(91): XF\\App->db()\n#5 /home/domain/web/domain.org/public_html/forums/src/XF/App.php(2837): XF\\Error->logException(Object(ErrorException), true, '')\n#6 /home/domain/web/domain.org/public_html/forums/src/XF.php(287): XF\\App->logException(Object(ErrorException), true)\n#7 [internal function]: XF::handleFatalError()\n#8 {...'
 
Here is the full code in config.

Code:
<?php

$config['db']['host'] = 'localhost';
$config['db']['port'] = 'XXX';
$config['db']['username'] = 'XXX';
$config['db']['password'] = 'XXX';
$config['db']['dbname'] = 'XXX';

$config['fullUnicode'] = true;

$config['enableAddOnArchiveInstaller'] = true;

$config['removeThemeHouseBranding'] = true;


#PHP:
#
#$s3 = function()
#{
#   return new \Aws\S3\S3Client([
#      'credentials' => [
#         'key' => 'XXX',
#         'secret' => 'XXX'
#      ],
#      'region' => 'tor1',
#      'version' => 'latest',
#      'endpoint' => 'https://tor1.digitaloceanspaces.com'
#   ]);
#};

#PHP:
#
#$config['fsAdapters']['data'] = function() use($s3)
#{
#   return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), 'XXX', 'data');
#};

#PHP:
#
#$config['externalDataUrl'] = function($externalPath, $canonical)
#{
#   return 'https://XXX.tor1.digitaloceanspaces.com/data/' . $externalPath;
#};
 
I've used this before in the past, but now I'm having difficulty with setup on another forum.

It's XF 2.2.17, using PHP 8.1.31. I'm getting numerous Guzzle related class not found errors trying to load every page. I've disabled the add-on and commented out the code in config.php until I can resolve it. Was there something changed in 2.2.17?
 
I assume the silence means there's no solution for me, other than perhaps waiting until this forum is ready for 2.3?
 
Fatal error: Uncaught Error: Class "GuzzleHttp\Psr7\Uri" not found in /home/xxxxxx/public_html/src/vendor/guzzlehttp/psr7/src/Utils.php:423 Stack trace: #0 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Api/Serializer/RestSerializer.php(41): GuzzleHttp\Psr7\Utils::uriFor('https://nyc3.di...') #1 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Api/Serializer/RestXmlSerializer.php(25): Aws\Api\Serializer\RestSerializer->__construct(Object(Aws\Api\Service), 'https://nyc3.di...') #2 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Api/Service.php(95): Aws\Api\Serializer\RestXmlSerializer->__construct(Object(Aws\Api\Service), 'https://nyc3.di...') #3 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/ClientResolver.php(1161): Aws\Api\Service::createSerializer(Object(Aws\Api\Service), 'https://nyc3.di...') #4 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/ClientResolver.php(400): Aws\ClientResolver::_default_serializer(Array) #5 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/AwsClient.php(248): Aws\ClientResolver->resolve(Array, Object(Aws\HandlerList)) #6 /home/xxxxxx/public_html/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/S3/S3Client.php(386): Aws\AwsClient->__construct(Array) #7 /home/xxxxxx/public_html/src/config.php(43): Aws\S3\S3Client->__construct(Array) #8 /home/xxxxxx/public_html/src/config.php(57): XF\App->{closure}() #9 /home/xxxxxx/public_html/src/XF/FsMounts.php(19): XF\App->{closure}() #10 /home/xxxxxx/public_html/src/XF/App.php(1117): XF\FsMounts::loadDefaultMounts(Array) #11 /home/xxxxxx/public_html/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #12 /home/xxxxxx/public_html/src/XF/App.php(2762): XF\Container->offsetGet('fs') #13 /home/xxxxxx/public_html/src/XF.php(944): XF\App->fs() #14 /home/xxxxxx/public_html/src/XF/Util/File.php(770): XF::fs() #15 /home/xxxxxx/public_html/src/XF/Error.php(102): XF\Util\File::installLockExists() #16 /home/xxxxxx/public_html/src/XF/App.php(2524): XF\Error->logException(Object(ErrorException), true, '') #17 /home/xxxxxx/public_html/src/XF.php(240): XF\App->logException(Object(ErrorException), true) #18 [internal function]: XF::handleFatalError() #19 {main} thrown in /home/xxxxxx/public_html/src/vendor/guzzlehttp/psr7/src/Utils.php on line 423
 
And another example:
Code:
[LIST]
[*]ErrorException: Fatal Error: Declaration of GuzzleHttp\Psr7\Uri::getScheme() must be compatible with Psr\Http\Message\UriInterface::getScheme(): string
[*]src/vendor/guzzlehttp/psr7/src/Uri.php:423
[/LIST]
 
Just checked this class and function and all is present and correct and as it should be. This leads me to believe you may have an add-on which itself is including a different version of Guzzle to the one we ship.

So first step is to comment out the config.php stuff, disable all add-ons, re-enable the add-on, uncomment the config, and test again. I’m guessing it will work. Then re-enable each add-on to figure out which one causes the issue.
 
Just checked this class and function and all is present and correct and as it should be. This leads me to believe you may have an add-on which itself is including a different version of Guzzle to the one we ship.

Yes, IIRC, my experience with this error indicated either a different version of Guzzle being required by an addon, or one of Guzzle's dependencies.

Note to @MySiteGuy - the version of Guzzle shipped with XF changed between v2.2 and v2.3 which could introduce incompatibilities with certain addons, depending on how they are built. You'll need to identify the addon causing the issue as per Chris D's instructions and then ask the addon developer to release a version compatible with what you are running.
 
The weird thing is the only files I can find for Guzzle are those in this S3 add-on, and the regular XF files:
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV6
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV6/GuzzleHandler.php
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleHandler.php
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleStream.php
./vendor/guzzlehttp
./vendor/guzzlehttp/guzzle
./vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php

I'll try turning off the add-ons and turning them on one at a time. I don't look forward to it since this install has many!
 
The weird thing is the only files I can find for Guzzle are those in this S3 add-on, and the regular XF files:
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV6
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV6/GuzzleHandler.php
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleHandler.php
./addons/XFAws/_vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleStream.php
./vendor/guzzlehttp
./vendor/guzzlehttp/guzzle
./vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php

I'll try turning off the add-ons and turning them on one at a time. I don't look forward to it since this install has many!
What version of XF are you currently running?
 
Back
Top Bottom