APCu with PHP7 on Dreamhost

Submitted by kentr on 07/07/2016, 10:20
  1. Download & unpack APCu
    # Edit the APCu version as needed.
    $ APCU_VERSION='5.1.15'; \
    curl -s https://pecl.php.net/get/apcu-${APCU_VERSION}.tgz | tar xzvf - && \
    cd apcu-${APCU_VERSION}
  2. phpize with PHP7, then configure, make, and copy into the extension directory
    # Edit PHP_VERSION as needed.
    $ export PHP_VERSION='7.1'; \
    /usr/local/php$(echo $PHP_VERSION | tr -d '.')/bin/phpize && \
    ./configure && \
    make && \
    mkdir -p ~/.php/${PHP_VERSION}/extensions && \
    cp modules/apcu.so ${HOME}/.php/${PHP_VERSION}/extensions
  3. Enable the extension in the corresponding phprc file:
    $ echo "extension='${HOME}/.php/${PHP_VERSION}/extensions/apcu.so'" >> ${HOME}/.php/${PHP_VERSION}/phprc
  4. Kill fcgi processes to force config reload:
    $ killall -9 php$(echo $PHP_VERSION | tr -d '.').cgi



For me, on php 7.2, I needed to make a change: When I ran "./configure && \" I got an error that php-config is misssing, so I had to run: ./configure --with-php-config=/usr/local/php72/bin/php-config && \ Also, the first line of that same step is /usr/local/php72/bin/phpize && \

Thanks for these awesome directions! I just wanted to echo what David said, I got the same error: "configure: error: Cannot find php-config. Please use --with-php-config=PATH" So I replaced the line with the line he had posted: ./configure --with-php-config=/usr/local/php72/bin/php-config && \ I'm sorry that I couldn't figure out how line breaks worked, I tried html and a bbcode BR and neither worked, neither did single or double spacing return a line break. Now it's just one long line hard to read comment. :( Anyways, This should be a DreamHost wiki page!

Add new comment