AWS SDK for PHP
Developer Guide

Installing the AWS SDK for PHP Version 3

You can install the AWS SDK for PHP Version 3 by using:

  • Composer

  • The prepackaged phar in the SDK

  • The ZIP file in the SDK

Installing by Using Composer

Composer is the recommended way to install the AWS SDK for PHP. Composer is a tool for PHP that manages and installs the dependencies of your project.

  1. Download and install Composer.

    For Windows, download and run the Composer-Setup.exe.

    For Linux, type the following at the command line to install Composer.

    curl -sS https://getcomposer.org/installer | php
  2. Type the Composer command to install the latest version of the AWS SDK for PHP.

    php -d memory_limit=-1 composer.phar require aws/aws-sdk-php
  3. Require the Composer autoloader in your scripts.

    <?php require '/path/to/vendor/autoload.php'; ?>

For more information on how to install Composer, configure autoloading, and follow other best practices for defining dependencies, see getcomposer.org.

Installing by Using the Packaged Phar

Each release of the AWS SDK for PHP includes a prepackaged phar (PHP archive) that contains all the classes and dependencies you need to run the SDK. Additionally, the phar automatically registers a class autoloader for the AWS SDK for PHP and all its dependencies.

You can download the packaged phar and include it in your scripts.

<?php require '/path/to/aws.phar'; ?>

Note

Using PHP with the Suhosin patch is not recommended, but is common on Ubuntu and Debian distributions. In this case, you might need to enable the use of phars in the suhosin.ini. If you don't do this, including a phar file in your code will cause a silent failure. To modify suhosin.ini, add the following line.

suhosin.executor.include.whitelist = phar

Installing by Using the ZIP file

The AWS SDK for PHP includes a ZIP file containing all the classes and dependencies you need to run the SDK. Additionally, the ZIP file includes a class autoloader for the AWS SDK for PHP and its dependencies.

To install the SDK, download the .zip file, and then extract it into your project at a location you choose. Then include the autoloader in your scripts, as follows.

<?php require '/path/to/aws-autoloader.php'; ?>