Skip to content

Instantly share code, notes, and snippets.

@lucatume
Last active July 13, 2021 04:35
Show Gist options
  • Save lucatume/f7b05bffeda8b15edc7bd0663d3d3384 to your computer and use it in GitHub Desktop.
Save lucatume/f7b05bffeda8b15edc7bd0663d3d3384 to your computer and use it in GitHub Desktop.
Local Addon Docker Containers PHP extensions installation
# While working with Local, by FlyWheel, there might be the need to install the Imagick PHP
# extension on specific PHP version used in the container serving the site.
# The Imagick PHP extension version is locked to compile on PHP 5.2.17 but newer versions of PHP
# might allow using the latest version.
bash -c 'export IMAGICK_VERSION=3.1.2 && \
export PHP_VERSION=5.2.17 && \
apt-get update && \
apt-get install imagemagick libmagickcore-dev libmagickwand-dev wget make autoconf -y && \
export WAND_BINARY=$(find / -name "MagickWand-config") && \
mkdir -p $($WAND_BINARY --prefix)/include/wand && \
export WAND_DIR=$($WAND_BINARY --prefix) && \
ln -s $(find / -name "MagickWand.h") $WAND_DIR/include/wand/MagickWand.h && \
mv $WAND_DIR/include/wand/MagickWand.h $WAND_DIR/include/wand/magick-wand.h && \
cd /opt/php/$PHP_VERSION/bin && \
wget https://pecl.php.net/get/imagick-$IMAGICK_VERSION -O imagick && \
tar -xvf imagick && \
rm imagick package.xml && \
export PHPCONFIG=$(pwd)/php-config && \
cd imagick-$IMAGICK_VERSION && \
export IMAGICK=/usr/lib/x86_64-linux-gnu/$(ls /usr/lib/x86_64-linux-gnu | grep ImageMagick) && \
./../phpize && \
./configure --with-php-config=$PHPCONFIG --with-imagick=$IMAGICK && \
make && \
make install && \
echo "extension=imagick.so" >> /conf/php/$PHP_VERSION/php.ini'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment