I'm trying to set up the AWS SDK for PHP on an EC2 instance, but I am having trouble getting the SDK to work. Just to note, I'm new to all AWS services, and I've only written PHP scripts, I've never configured it before. When I run the following script, I get "Fatal error: Class 'AmazonEC2' not found in /opt/lampp/htdocs/index.php on line 6":
require_once 'sdk.class.php';
$ec2 = new AmazonEC2(); //Line 6
As far as I can tell, the AmazonEC2 class is in:
/opt/lampp/lib/php/AWSSDKforPHP/services/ec2.class.php
I followed this setup guide: http://aws.amazon.com/articles/PHP/4261
Here are some details:
- EC2 Instance: t1.Micro node of
Basic 32-bit Amazon Linux AMI 2010.11.1 Beta (AMI Id: ami-76f0061f)
- PHP is set up using XAMPP. Basically untar into /opt/lampp, where it is self contained.
- SDK installed using PEAR. Done with:
- sudo /opt/lampp/bin/pear channel-discover pear.amazonwebservices.com
- sudo /opt/lampp/bin/pear install aws/sdk
My path was set to ".:/opt/lampp/lib/php" by default. I tried adding ".:/opt/lampp/lib/php/AWSSDKforPHP" but that didn't work. I tried changing file permissions, but no dice.
I've never used PEAR before, or XAMPP. Any ideas for how I can get the SDK working with PHP? I'm thinking it has to be just an include_path issue, but I'm not sure what to set it to work. (I reset apache after I change php.ini so that isn't the issue either).
Here are some paths on my system:
/opt/lampp/lib/php/AWSSDKforPHP
/opt/lampp/etc/php.ini
/opt/lampp/htdocs/index.php
/home/ec2-user/.aws/sdk/config.inc.php