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

Compiling the Source Code for the ElastiCache Cluster Client for PHP

This section covers how to obtain and compile the source code for the ElastiCache Cluster Client for PHP.

There are two packages you need to pull from GitHub and compile; aws-elasticache-cluster-client-libmemcached and aws-elasticache-cluster-client-memcached-for-php.

Compiling the libmemcached Library

To compile the aws-elasticache-cluster-client-libmemcached library

  1. Launch an Amazon EC2 instance.

  2. Install the library dependencies.

    • On Amazon Linux 201509 AMI

      Copy
      sudo yum install gcc gcc-c++ autoconf libevent-devel
    • On Ubuntu 14.04 AMI

      Copy
      sudo apt-get update sudo apt-get install libevent-dev gcc g++ make autoconf libsasl2-dev
  3. Pull the repository and compile the code.

    Copy
    git clone https://github.com/awslabs/aws-elasticache-cluster-client-libmemcached.git cd aws-elasticache-cluster-client-libmemcached mkdir BUILD cd BUILD ../configure --prefix=<libmemcached-install-directory> --with-pic make sudo make install

Compiling the ElastiCache Memcached Auto Discovery Client for PHP

The following sections describe how to compile the ElastiCache Memcached Auto Discovery Client

Compiling the ElastiCache Memcached Client for PHP 7

Run the following set of commands under the code directory.

Copy
git clone https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php.git cd aws-elasticache-cluster-client-memcached-for-php git checkout php7 sudo yum install php70-devel phpize ./configure --with-libmemcached-dir=<libmemcached-install-directory> --disable-memcached-sasl make make install

Note

You can statically link the libmemcached library into the PHP binary so it can be ported across various Linux platforms. To do that, run the following command before make:

Copy
sed -i "s#-lmemcached#<libmemcached-install-directory>/lib/libmemcached.a -lcrypt -lpthread -lm -lstdc++ -lsasl2#" Makefile

Compiling the ElastiCache Memcached Client for PHP 5

Compile the aws-elasticache-cluster-client-memcached-for-php by running the following commands under the aws-elasticache-cluster-client-memcached-for-php/ folder.

Copy
git clone https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php.git cd aws-elasticache-cluster-client-memcached-for-php sudo yum install zlib-devel phpize ./configure --with-libmemcached-dir=<libmemcached-install-directory> make make install