Skip to main content
  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

     

Comments

Pan

Feb 27, 2018 - 12:09pm

Thank you, that works perfectly on Dreamhost! :)

David

Apr 22, 2019 - 11:39pm

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 && \

Interesting.  It worked for me as-is with PHP7.2.

It's not working on PHP7.3, though.  Appears to be an issue with APCu BC, and I was unable to install both of them in a way that worked.

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