Menu
Amazon ElastiCache
User Guide (API Version 2015-02-02)

Installation Steps for New Users

Installing PHP 7.x for New Users

To install PHP 7 on a Ubuntu Server 14.04 LTS AMI (64-bit and 32-bit)

  1. Launch a new instance from the AMI.

  2. Run the following commands:

    Copy
    sudo apt-get update sudo apt-get install gcc g++
  3. Install PHP 7.

    Copy
    sudo yum install php70
  4. Download and unzip Amazon ElastiCache Cluster Client.

    Copy
    wget https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.0/latest-64bit
  5. With root permissions, copy the extracted artifact file amazon-elasticache-cluster-client.so into /usr/lib/php/20151012.

    Copy
    sudo mv artifact/amazon-elasticache-cluster-client.so /usr/lib/php/20151012
  6. Insert the line extension=amazon-elasticache-cluster-client.so into the file /etc/php/7.0/cli/php.ini.

    Copy
    echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php/7.0/cli/php.ini
  7. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

 

To install PHP 7 on an Amazon Linux 201609 AMI

  1. Launch a new instance from the AMI.

  2. Run the following command:

    Copy
    sudo yum install gcc-c++
  3. Install PHP 7.

    Copy
    sudo yum install php70
  4. Download and unzip Amazon ElastiCache Cluster Client.

    Copy
    wget https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.0/latest-64bit
  5. With root permission, copy the extracted artifact file amazon-elasticache-cluster-client.so into /usr/lib64/php/7.0/modules/.

    Copy
    sudo mv artifact/amazon-elasticache-cluster-client.so /usr/lib64/php/7.0/modules/
  6. Create the 50-memcached.ini file.

    Copy
    echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php-7.0.d/50-memcached.ini
  7. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

 

To install PHP 7 on an SUSE Linux AMI

  1. Launch a new instance from the AMI.

  2. Run the following command:

    Copy
    sudo zypper install gcc
  3. Install PHP 7.

    Copy
    sudo yum install php70
  4. Download and unzip Amazon ElastiCache Cluster Client.

    Copy
    wget https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.0/latest-64bit
  5. With root permission, copy the extracted artifact file amazon-elasticache-cluster-client.so into /usr/lib64/php7/extensions/.

    Copy
    sudo mv artifact/amazon-elasticache-cluster-client.so /usr/lib64/php7/extensions/
  6. Insert the line extension=amazon-elasticache-cluster-client.so into the file /etc/php7/cli/php.ini.

    Copy
    echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php7/cli/php.ini
  7. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

 

Installing PHP 5.x for New Users

To install PHP 5 on an Amazon Linux AMI 2014.03 (64-bit and 32-bit)

  1. Launch an Amazon Linux instance (either 64-bit or 32-bit) and log into it.

  2. Install PHP dependencies:

    Copy
    $ sudo yum install gcc-c++ php php-pear
  3. Download the correct php-memcached package for your Amazon EC2 instance and PHP version. For more information, see Downloading the Installation Package.

  4. Install php-memcached. The URI should be the download path for the installation package:

    Copy
    $ sudo pecl install <package download path>

    Here is a sample installation command for PHP 5.4, 64-bit Linux. In this sample, replace X.Y.Z with the actual version number:

    Copy
    $ sudo pecl install /home/AmazonElastiCacheClusterClient-X.Y.Z-PHP54-64bit.tgz

    Note

    Please use the latest version of the install artifact.

  5. With root/sudo permission, add a new file named memcached.ini in the /etc/php.d directory, and insert "extension=amazon-elasticache-cluster-client.so" in the file:

    Copy
    $ echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php.d/memcached.ini
  6. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

 

To install PHP 5 on a Red Hat Enterprise Linux 7.0 AMI (64-bit and 32-bit)

  1. Launch a Red Hat Enterprise Linux instance (either 64-bit or 32-bit) and log into it.

  2. Install PHP dependencies:

    Copy
    $ sudo yum install gcc-c++ php php-pear
  3. Download the correct php-memcached package for your Amazon EC2 instance and PHP version. For more information, see Downloading the Installation Package.

  4. Install php-memcached. The URI should be the download path for the installation package:

    Copy
    sudo pecl install <package download path>
  5. With root/sudo permission, add a new file named memcached.ini in the /etc/php.d directory, and insert extension=amazon-elasticache-cluster-client.so in the file.

    Copy
    echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php.d/memcached.ini
  6. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

 

To install PHP 5 on a Ubuntu Server 14.04 LTS AMI (64-bit and 32-bit)

  1. Launch an Ubuntu Linux instance (either 64-bit or 32-bit) and log into it.

  2. Install PHP dependencies:

    sudo apt-get update 
    sudo apt-get install gcc g++ php5 php-pear
  3. Download the correct php-memcached package for your Amazon EC2 instance and PHP version. For more information, see Downloading the Installation Package.

  4. Install php-memcached. The URI should be the download path for the installation package.

    Copy
    $ sudo pecl install <package download path>

    Note

    This installation step installs the build artifact amazon-elasticache-cluster-client.so into the /usr/lib/php5/20121212* directory. Please verify the absolute path of the build artifact because it is needed by the next step.

    If the previous command doesn't work, you need to manually extract the PHP client artifact amazon-elasticache-cluster-client.so from the downloaded *.tgz file, and copy it to the /usr/lib/php5/20121212* directory.

    $ tar -xvf <package download path>
    cp amazon-elasticache-cluster-client.so /usr/lib/php5/20121212/ 
  5. With root/sudo permission, add a new file named memcached.ini in the /etc/php5/cli/conf.d directory, and insert "extension=<absolute path to amazon-elasticache-cluster-client.so>" in the file.

    Copy
    $ echo "extension=<absolute path to amazon-elasticache-cluster-client.so>" | sudo tee /etc/php5/cli/conf.d/memcached.ini

 

To install PHP 5 for SUSE Linux Enterprise Server 11 AMI (64-bit or 32-bit)

  1. Launch a SUSE Linux instance (either 64-bit or 32-bit) and log into it.

  2. Install PHP dependencies:

    Copy
    $ sudo zypper install gcc php53-devel
  3. Download the correct php-memcached package for your Amazon EC2 instance and PHP version. For more information, see Downloading the Installation Package.

  4. Install php-memcached. The URI should be the download path for the installation package.

    Copy
    $ sudo pecl install <package download path>
  5. With root/sudo permission, add a new file named memcached.ini in the /etc/php5/conf.d directory, and insert extension=amazon-elasticache-cluster-client.so in the file.

    Copy
    $ echo "extension=amazon-elasticache-cluster-client.so" | sudo tee /etc/php5/conf.d/memcached.ini
  6. Start or restart your Apache server.

    Copy
    sudo /etc/init.d/httpd start

Note

If Step 5 doesn't work for any of the previous platforms, please verify the install path for amazon-elasticache-cluster-client.so, and specify the full path of the binary in the extension. Also, verify that the PHP in use is a supported version. We support versions 5.3 through 5.5.

 

Other Linux distributions

On some systems, notably CentOS7 and Red Hat Enterprise Linux (RHEL) 7.1, libsasl2.so.3 has replaced libsasl2.so.2. On those systems, when you load the ElastiCache cluster client, it attempts and fails to find and load libsasl2.so.2. To resolve this issue, create a symbolic link to libsasl2.so.3 so that when the client attempts to load libsasl2.so.2, it is redirected to libsasl2.so.3. The following code creates this symbolic link.

Copy
cd /usr/lib64 $ sudo ln libsasl2.so.3 libsasl2.so.2