0

I have a project that currently uses Guzzle (which is loaded [as a .phar] by an explicit "require_once" in a bootstrap file).

I have been trying to add the AWSSDKforPHP from Amazon, so that I can easily handle uploads to Amazon S3. Unfortunately, when I try to include the package (also packaged as a .phar file), PHP throws a nasty error:

 PHP Fatal error:  Cannot redeclare class Symfony\\Component\\ClassLoader\\UniversalClassLoader in phar:///usr/share/php/AWSSDKforPHP/aws.phar/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php on line 62

I have already turned off (completely) APC, as I've seen APC cause some require/include headaches before.

I doubt that PHP would have such an awkward limitation of only being able to include a package with a dependency once. ... But I could be wrong.

Rican7
  • 1,125
  • 2
  • 10
  • 28

1 Answers1

1

Looking at both of these libraries' phar stubs, I'm not sure why it's conflicting on the require_once of the UniversalClassLoader. The good news is that the phar provided by the AWS SDK for PHP 2 also includes the Guzzle library, so you only need to include the aws.phar in your application.

Michael Dowling
  • 5,098
  • 4
  • 32
  • 28
  • Hmm. I ended up using a different class for the [S3 service](https://github.com/tpyo/amazon-s3-php-class) anyway, but it'd definitely be nice to get an answer on this one. :/ – Rican7 Nov 15 '12 at 09:14