Skip to content

Instantly share code, notes, and snippets.

@xyzulu
Last active April 25, 2025 00:49
Show Gist options
  • Save xyzulu/d4a3fd071406310d0400ad8752033ac5 to your computer and use it in GitHub Desktop.
Save xyzulu/d4a3fd071406310d0400ad8752033ac5 to your computer and use it in GitHub Desktop.
Update/download the latest version of ioncube loaders and update them in /usr/local/ioncube
#!/bin/bash
IONCUBE_DIR="/usr/local/ioncube"
REFERENCE_FILE="$IONCUBE_DIR/loader-wizard.php"
TMP_DIR="/tmp/ioncube_update"
LATEST_URL="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz"
echo "Updating ionCube Loaders..."
# Ensure the reference file exists
if [[ ! -f "$REFERENCE_FILE" ]]; then
echo "Reference file $REFERENCE_FILE not found. Cannot determine ownership."
exit 1
fi
# Get ownership from the reference file
OWNER=$(stat -c "%U" "$REFERENCE_FILE")
GROUP=$(stat -c "%G" "$REFERENCE_FILE")
# Create temp directory
mkdir -p "$TMP_DIR"
cd "$TMP_DIR" || exit 1
# Download the latest ionCube loaders
echo "Downloading latest ionCube loaders..."
curl -sSLO "$LATEST_URL"
if [[ ! -f ioncube_loaders_lin_x86-64.tar.gz ]]; then
echo "Download failed."
exit 1
fi
# Extract and update
echo "Extracting and updating loaders..."
tar -xzf ioncube_loaders_lin_x86-64.tar.gz
cp -rp ioncube/* "$IONCUBE_DIR/"
# Apply ownership from loader-wizard.php to all new files
echo "Applying ownership from $REFERENCE_FILE ($OWNER:$GROUP)..."
chown -R "$OWNER:$GROUP" "$IONCUBE_DIR"
# Cleanup
echo "Cleaning up..."
rm -rf "$TMP_DIR"
echo "ionCube loaders updated successfully. You will need to restart php for each website you use the loaders on"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment