Install Phpredis On Elastic Beanstalk


Phpredis is not available as a package on Amazon Linux so we have to run a command to install it.

# these commands run before the application and web server are
# set up and the application version file is extracted.
        # run this command from /tmp directory
        cwd: /tmp
        # don't run the command if phpredis is already installed (file /etc/php.d/redis.ini exists)
        test: '[ ! -f /etc/php.d/redis.ini ] && echo "redis not installed"'
        # executed only if test command succeeds
        command: |
            wget -O \
            && unzip -o \
            && cd nicolasff-phpredis-* \
            && phpize \
            && ./configure \
            && make \
            && make install \
            && echo > /etc/php.d/redis.ini

See Amazon's documentation for more info.


Logs of the execution of .ebextension/*.config files are found in /var/log/cfn-init.log.

You should see something like

[DEBUG] Running command 01_redis_install
[DEBUG] Running test for command 01_redis_install
[DEBUG] Test command output: redis not installed
[DEBUG] Test for command 01_redis_install passed
[INFO] Command 01_redis_install succeeded
[DEBUG] Command 01_redis_install output: --2014-05-16 14:33:03--
Resolving (
Connecting to (||:443... connected.
Quentin Pleplé
May 2014