DEV Community

Cover image for Install ionCube Loader in Docker
Julian Finkler
Julian Finkler

Posted on

2

Install ionCube Loader in Docker

I wrote something that I need for my projects and I think this could be useful for you too.

You can install the ionCube loader automatically during image creation with the following script.

# Change the tag as needed
FROM php:8.3-apache

COPY --chmod=775 ioncube-loader-setup.sh /tmp/ioncube-loader-setup.sh
RUN set -x && bash -c /tmp/ioncube-loader-setup.sh
Enter fullscreen mode Exit fullscreen mode
# ioncube-loader-setup.sh

########################
# ionCube INSTALLATION #
########################

PHP_EXTENSION_DIR=$(php -r 'echo ini_get("extension_dir");')
echo "PHP_EXTENSION_DIR is $PHP_EXTENSION_DIR"
PHP_CONFIG_DIR=$(php -i | grep -ohP "with-config-file-scan-dir=([^']+)" | cut -d= -f2)
echo "PHP_CONFIG_DIR is $PHP_CONFIG_DIR"
PHP_VERSION=$(php -r 'list($major, $minor, $fix) = explode(".", phpversion(), 3); echo $major.".".$minor;')
echo "PHP_VERSION is $PHP_VERSION"

# Detect the correct ionCube loader architecture
IONCUBE_ARCH=""
ARCH=$(uname -m)
if [[ $ARCH == x86_64* ]]; then
  IONCUBE_ARCH="x86-64"
elif [[ $ARCH == i*86 ]]; then
  IONCUBE_ARCH="x86"
elif  [[ $ARCH = aarch64 ]]; then
  IONCUBE_ARCH="aarch64"
elif  [[ $ARCH == arm* ]]; then
  IONCUBE_ARCH="armv7l"
else
  echo "Unsupported ionCube loader architecture!" 1>&2
  exit 1
fi
echo "Detected ionCube loader architecture is $IONCUBE_ARCH based on $ARCH"

echo "Downloading the loader"
curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_$IONCUBE_ARCH.tar.gz

echo "Extracting the loader"
tar -xzvf ioncube_loaders_lin_$IONCUBE_ARCH.tar.gz

LOADER_FILE=$(ls ioncube/*8.3*.so | cat)
LOADER_FILENAME=$(echo $LOADER_FILE | cut -d/ -f2)

if [ ! -f $LOADER_FILE ]; then
  echo "No loader found for PHP $LOADER_LOADER_VERSION" 1>&2
  exit 2
fi

echo "Copy loader file $LOADER_FILE to $PHP_EXTENSION_DIR"
cp $LOADER_FILE "$PHP_EXTENSION_DIR"

echo "Writing PHP config $PHP_CONFIG_DIR/00-ioncube.ini"
cat <<EOF | tee $PHP_CONFIG_DIR/00-ioncube.ini
zend_extension=$LOADER_FILENAME
EOF

# Cleanup
rm -rf ./ioncube
rm ioncube_loaders_lin_$IONCUBE_ARCH.tar.gz
rm -f "${0}"
Enter fullscreen mode Exit fullscreen mode

https://gist.github.com/devtronic/e7780dfdb31f4aa6df261739ef987d77

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
πŸŽ₯ Audio/video file upload with real-time preview
πŸ—£οΈ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
πŸ“€ Export interview's subtitles in VTT format

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay