Skip to content

Instantly share code, notes, and snippets.

@rfay
Created July 28, 2025 22:49
Show Gist options
  • Select an option

  • Save rfay/ffb842b95a26f613f6051d9690e87526 to your computer and use it in GitHub Desktop.

Select an option

Save rfay/ffb842b95a26f613f6051d9690e87526 to your computer and use it in GitHub Desktop.
deb.sury.org Missing Packages Checker - Diagnostic tool for PHP package availability in Sury repository

deb.sury.org Missing Packages Checker

A bash script to systematically check for missing PHP packages in the Sury PHP repository for Debian distributions.

Purpose

This script helps identify missing PHP packages across different PHP versions and architectures in the Sury repository. It's particularly useful when experiencing package availability issues on newer Debian distributions.

Usage

# Check packages for Debian Trixie (default)
./sury_missing_packages_checker.sh

# Check packages for a specific Debian codename
./sury_missing_packages_checker.sh bookworm
./sury_missing_packages_checker.sh bullseye

What it does

  1. Downloads package metadata from packages.sury.org for both amd64 and arm64 architectures
  2. Tests availability of 29 common PHP extensions across 11 PHP versions (5.6-8.4)
  3. Generates two reports:
    • Detailed report: Lists all missing packages with architecture info
    • Consolidated report: Groups missing packages by extension with PHP version breakdown

Sample Output

Extension: memcached
  php5.6: arm64
  php7.0: amd64, arm64
  php7.1: amd64, arm64
  php8.1: amd64, arm64

Extension: redis
  php7.0: amd64, arm64
  php7.1: amd64, arm64

Requirements

  • bash (with standard utilities)
  • curl
  • gunzip

Tested Extensions

The script checks these PHP extensions:

  • Core: cli, common, fpm, opcache
  • Database: mysql, pgsql, sqlite3
  • Caching: apcu, apcu-bc, memcached, redis
  • Web: curl, soap, xml, xmlrpc
  • Graphics: gd, imagick
  • Compression: bz2, zip
  • Text: intl, json, mbstring
  • Security: mcrypt, ldap, readline
  • Development: xdebug, xhprof, uploadprogress

Use Cases

  • Troubleshooting container build failures on new Debian versions
  • Reporting missing packages to the Sury repository maintainers
  • Planning PHP version upgrades and extension compatibility
  • Creating workarounds for missing packages

Reporting Issues

If you find missing packages, create an issue at: https://github.com/oerdnj/deb.sury.org/issues

Include the generated reports to help maintainers understand the scope of the issue.

License

MIT License - Feel free to modify and distribute.

Generated By

This script was created with assistance from Claude Code to systematically diagnose PHP package availability issues in the Sury repository.

# Consolidated Missing PHP Packages Report - Debian trixie (Mon Jul 28 16:41:57 MDT 2025)
# Generated by sury_missing_packages_checker.sh
# Repository: https://packages.sury.org/php/
# Format: Extension -> PHP versions missing (architectures)
Extension: apcu-bc
php5.6: amd64, arm64
php7.0: amd64, arm64
php7.1: amd64, arm64
php7.2: amd64, arm64
php7.3: amd64, arm64
php7.4: amd64, arm64
php8.0: amd64, arm64
php8.1: amd64, arm64
php8.2: amd64, arm64
php8.3: amd64, arm64
php8.4: amd64, arm64
Extension: json
php8.0: amd64, arm64
php8.1: amd64, arm64
php8.2: amd64, arm64
php8.3: amd64, arm64
php8.4: amd64, arm64
Extension: memcached
php5.6: arm64
php7.0: amd64, arm64
php7.1: amd64, arm64
php7.2: amd64, arm64
php7.3: amd64, arm64
php7.4: amd64, arm64
php8.0: amd64, arm64
php8.1: amd64, arm64
php8.2: amd64, arm64
php8.3: amd64, arm64
php8.4: amd64, arm64
Extension: redis
php7.0: amd64, arm64
php7.1: amd64, arm64
php7.2: amd64, arm64
php7.3: amd64, arm64
#!/bin/bash
set -eu -o pipefail
# deb.sury.org Missing Packages Checker
#
# This script systematically checks for missing PHP packages in the Sury repository
# for a specific Debian distribution (default: trixie).
#
# It downloads package metadata and checks availability across all PHP versions
# and architectures, then generates a consolidated report of missing packages.
#
# Usage: ./sury_missing_packages_checker.sh [DEBIAN_CODENAME]
# Example: ./sury_missing_packages_checker.sh bookworm
#
# Author: Generated with Claude Code (https://claude.ai/code)
# License: MIT
# Configuration
DEBIAN_CODENAME="${1:-trixie}" # Default to trixie, allow override via command line
PHP_VERSIONS=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4")
ARCHITECTURES=("amd64" "arm64")
# Extensions to test (comprehensive list from DDEV requirements)
EXTENSIONS=("apcu" "apcu-bc" "bcmath" "bz2" "cli" "common" "curl" "fpm" "gd" "imagick" "intl" "json" "ldap" "mbstring" "mcrypt" "memcached" "mysql" "opcache" "pgsql" "readline" "redis" "soap" "sqlite3" "uploadprogress" "xdebug" "xhprof" "xml" "xmlrpc" "zip")
# Output files
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
MISSING_PACKAGES="sury_missing_packages_${DEBIAN_CODENAME}_${TIMESTAMP}.txt"
echo "deb.sury.org Missing Packages Checker"
echo "====================================="
echo "Debian codename: $DEBIAN_CODENAME"
echo "Testing $(( ${#PHP_VERSIONS[@]} * ${#EXTENSIONS[@]} * ${#ARCHITECTURES[@]} )) package combinations..."
echo "Missing packages will be saved to: $MISSING_PACKAGES"
echo ""
# Download package lists for both architectures
echo "Downloading package lists..."
for arch in "${ARCHITECTURES[@]}"; do
echo " Downloading ${arch} package list for ${DEBIAN_CODENAME}..."
if ! curl -s "https://packages.sury.org/php/dists/${DEBIAN_CODENAME}/main/binary-${arch}/Packages.gz" | gunzip > "/tmp/packages_${arch}.txt" 2>/dev/null; then
echo " ERROR: Failed to download or decompress package list for ${arch}"
echo " Please check if ${DEBIAN_CODENAME} is a valid distribution name"
exit 1
fi
# Verify the file was created and has content
if [[ ! -s "/tmp/packages_${arch}.txt" ]]; then
echo " ERROR: Package list for ${arch} is empty"
exit 1
fi
echo " Downloaded $(wc -l < "/tmp/packages_${arch}.txt") lines for ${arch}"
done
# Function to test package availability in downloaded package lists
test_web_package_availability() {
local php_version=$1
local extension=$2
local arch=$3
local package_name="php${php_version}-${extension}"
if grep -q "^Package: $package_name$" "/tmp/packages_${arch}.txt" 2>/dev/null; then
echo "AVAILABLE"
else
echo "MISSING"
fi
}
# Initialize output files
echo "# Missing PHP packages on Debian $DEBIAN_CODENAME from deb.sury.org ($(date))" > "$MISSING_PACKAGES"
echo "# Generated by sury_missing_packages_checker.sh" >> "$MISSING_PACKAGES"
echo "# Repository: https://packages.sury.org/php/" >> "$MISSING_PACKAGES"
echo "" >> "$MISSING_PACKAGES"
# Test all combinations
total_tests=$((${#PHP_VERSIONS[@]} * ${#EXTENSIONS[@]} * ${#ARCHITECTURES[@]}))
current_test=0
for php_version in "${PHP_VERSIONS[@]}"; do
for extension in "${EXTENSIONS[@]}"; do
for arch in "${ARCHITECTURES[@]}"; do
current_test=$((current_test + 1))
package_name="php${php_version}-${extension}"
echo -n "Testing $package_name ($arch) ... [$current_test/$total_tests] "
result=$(test_web_package_availability "$php_version" "$extension" "$arch")
case "$result" in
"AVAILABLE")
echo "✓ AVAILABLE"
;;
"MISSING")
echo "✗ MISSING"
echo "$package_name ($arch)" >> "$MISSING_PACKAGES"
;;
esac
done
done
done
# Generate consolidated missing packages report
echo ""
echo "Generating consolidated report..."
# Create a temporary associative array structure using files
rm -f /tmp/missing_by_extension_*
# Parse missing packages and group by extension
while IFS= read -r line; do
if [[ $line =~ ^php([0-9.]+)-([a-zA-Z0-9_-]+)\ \(([a-zA-Z0-9]+)\)$ ]]; then
php_ver="${BASH_REMATCH[1]}"
extension="${BASH_REMATCH[2]}"
arch="${BASH_REMATCH[3]}"
echo "$php_ver:$arch" >> "/tmp/missing_by_extension_$extension"
fi
done < "$MISSING_PACKAGES"
# Generate consolidated report
CONSOLIDATED_MISSING="sury_consolidated_missing_${DEBIAN_CODENAME}_${TIMESTAMP}.txt"
echo "# Consolidated Missing PHP Packages Report - Debian $DEBIAN_CODENAME ($(date))" > "$CONSOLIDATED_MISSING"
echo "# Generated by sury_missing_packages_checker.sh" >> "$CONSOLIDATED_MISSING"
echo "# Repository: https://packages.sury.org/php/" >> "$CONSOLIDATED_MISSING"
echo "# Format: Extension -> PHP versions missing (architectures)" >> "$CONSOLIDATED_MISSING"
echo "" >> "$CONSOLIDATED_MISSING"
missing_extensions=0
total_missing_count=0
for ext_file in /tmp/missing_by_extension_*; do
if [[ -f "$ext_file" ]]; then
extension=$(basename "$ext_file" | sed 's/missing_by_extension_//')
missing_extensions=$((missing_extensions + 1))
echo "Extension: $extension" >> "$CONSOLIDATED_MISSING"
# Group by PHP version using a simpler approach
while IFS=: read -r php_ver arch; do
total_missing_count=$((total_missing_count + 1))
done < "$ext_file"
# Output grouped by PHP version
for php_ver in $(cut -d: -f1 "$ext_file" | sort -V -u); do
arches=$(grep "^$php_ver:" "$ext_file" | cut -d: -f2 | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /g')
echo " php$php_ver: $arches" >> "$CONSOLIDATED_MISSING"
done
echo "" >> "$CONSOLIDATED_MISSING"
fi
done
echo "Web-based testing completed!"
echo "Missing extensions: $missing_extensions"
echo "Total missing packages: $total_missing_count"
echo ""
echo "Results saved to:"
echo " Detailed missing: $MISSING_PACKAGES"
echo " Consolidated missing: $CONSOLIDATED_MISSING"
# Show the consolidated report
echo ""
echo "=== CONSOLIDATED MISSING PACKAGES REPORT ==="
grep -v "^#" "$CONSOLIDATED_MISSING"
# Cleanup
rm -f /tmp/packages_*.txt /tmp/missing_by_extension_*
echo ""
echo "=========================================="
echo "Report generated successfully!"
echo ""
echo "Files created:"
echo " - Detailed missing packages: $MISSING_PACKAGES"
echo " - Consolidated summary: $CONSOLIDATED_MISSING"
echo ""
echo "NOTE: This script only verifies package metadata presence in the repository."
echo "For installation verification, test actual package installation in a container."
echo ""
echo "To report issues, create an issue at: https://github.com/oerdnj/deb.sury.org/issues"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment