Ioncube Loader Script for Multiple PHP Versions

Discussion in 'Tips/Tricks/Mods' started by ahrasis, Jan 8, 2021.

  1. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I thought of sharing this for those who need it, though one may found that this method is a little different than other tutorials available (or may be more) but I believe that this is how this php module should be managed, so enjoy.
    Code:
    # Donwload, extract & move respective Ioncube Loader .so file accordingly
    cd /tmp
    sudo  wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
    sudo  tar xzf ioncube_loaders_lin_x86-64.tar.gz
    cd ioncube
    if [ -e "ioncube_loader_lin_5.6.so" ]; then sudo cp -a ioncube_loader_lin_5.6.so /usr/lib/php/20131226/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.0.so" ]; then sudo cp -a ioncube_loader_lin_7.0.so /usr/lib/php/20151012/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.1.so" ]; then sudo cp -a ioncube_loader_lin_7.1.so /usr/lib/php/20160303/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.2.so" ]; then sudo cp -a ioncube_loader_lin_7.2.so /usr/lib/php/20170718/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.3.so" ]; then sudo cp -a ioncube_loader_lin_7.3.so /usr/lib/php/20180731/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.4.so" ]; then sudo cp -a ioncube_loader_lin_7.4.so /usr/lib/php/20190902/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.0.so" ]; then sudo cp -a ioncube_loader_lin_8.0.so /usr/lib/php/20200930/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.1.so" ]; then sudo cp -a ioncube_loader_lin_8.1.so /usr/lib/php/20210902/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.2.so" ]; then sudo cp -a ioncube_loader_lin_8.2.so /usr/lib/php/20220829/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.3.so" ]; then sudo cp -a ioncube_loader_lin_8.3.so /usr/lib/php/20230831/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.4.so" ]; then sudo cp -a ioncube_loader_lin_8.4.so /usr/lib/php/20240924/ioncube.so; fi
    # Create ioncube.ini & copy it to respective php module folder
    sudo  cat <<EOT >> ioncube.ini
    ; configuration for php ioncube module
    ; priority=10
    zend_extension=ioncube.so
    ioncube.enable=1
    EOT
    sudo  xargs -n 1 cp -v ioncube.ini<<<"/etc/php/5.6/mods-available/ /etc/php/7.0/mods-available/ /etc/php/7.1/mods-available/ /etc/php/7.2/mods-available/ /etc/php/7.3/mods-available/ /etc/php/7.4/mods-available/ /etc/php/8.0/mods-available/ /etc/php/8.1/mods-available/ /etc/php/8.2/mods-available/ /etc/php/8.3/mods-available/ /etc/php/8.4/mods-available/"
    
    # Enable Ioncube Loader & restart all php-fpm
    phpenmod ioncube
    if [ $(dpkg-query -W -f='${Status}' php5.6-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php5.6-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.0-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.0-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.1-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.1-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.2-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.2-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.3-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.3-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.4-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.4-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.0-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.0-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.1-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.1-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.2-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.2-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.3-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.3-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.4-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.4-fpm restart; fi
    cd /root
    
     
    Last edited: Jun 9, 2025
    Pappmann, felan, WolfTongue and 3 others like this.
  2. Dennis_sp

    Dennis_sp Member

    Thanks for this script!
     
    ahrasis likes this.
  3. WolfTongue

    WolfTongue New Member

    Thank you very much for your script! I do not know if the php paths could change but if they can this could be more stable:

    Changes:
    It uses the php-config command to get the extension directory.

    Code:
    # Donwload, extract & move respective Ioncube Loader .so file accordingly
    cd /tmp
    sudo  wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
    sudo  tar xzf ioncube_loaders_lin_x86-64.tar.gz
    cd ioncube
    if [ -e "ioncube_loader_lin_5.6.so" ]; then sudo cp -a ioncube_loader_lin_5.6.so $(/usr/bin/php-config5.6 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.0.so" ]; then sudo cp -a ioncube_loader_lin_7.0.so $(/usr/bin/php-config7.0 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.1.so" ]; then sudo cp -a ioncube_loader_lin_7.1.so $(/usr/bin/php-config7.1 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.2.so" ]; then sudo cp -a ioncube_loader_lin_7.2.so $(/usr/bin/php-config7.2 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.3.so" ]; then sudo cp -a ioncube_loader_lin_7.3.so $(/usr/bin/php-config7.3 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_7.4.so" ]; then sudo cp -a ioncube_loader_lin_7.4.so $(/usr/bin/php-config7.4 --extension-dir)/ioncube.so; fi
    if [ -e "ioncube_loader_lin_8.0.so" ]; then sudo cp -a ioncube_loader_lin_8.0.so $(/usr/bin/php-config8.0 --extension-dir)/ioncube.so; fi
    
    # Create ioncube.ini & copy it to respective php module folder
    sudo  cat <<EOT >> ioncube.ini
    ; configuration for php ioncube module
    ; priority=10
    zend_extension=ioncube.so
    ioncube.enable=1
    EOT
    sudo  xargs -n 1 cp -v ioncube.ini<<<"/etc/php/5.6/mods-available/ /etc/php/7.0/mods-available/ /etc/php/7.1/mods-available/ /etc/php/7.2/mods-available/
     /etc/php/7.3/mods-available/ /etc/php/7.4/mods-available/ /etc/php/8.0/mods-available/"
    
    # Enable Ioncube Loader & restart all php-fpm
    phpenmod ioncube
    if [ $(dpkg-query -W -f='${Status}' php5.6-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php5.6-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.0-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.0-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.1-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.1-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.2-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.2-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.3-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.3-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php7.4-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php7.4-fpm restart; fi
    if [ $(dpkg-query -W -f='${Status}' php8.0-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.0-fpm restart; fi
    cd -
     
    ahrasis and Jesse Norell like this.
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Smart and thank you very much. I remember @Jesse Norell were trying to integrate this into ISPConfig Auto Installer so hopefully your improvement shall ease that, though the AI is in php but this could help as well.
     
  5. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated the code in the first post to cover up to php8.2 though ioncube loader for php8.2 is not available yet.
     
    till likes this.
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated the code in the first post to cover up to php8.3 as ioncube loader for php8.3 is already released.
     
    atle and till like this.
  7. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated the code in the first post to cover up to php8.4 as ioncube loader.
     
    till likes this.
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Since 20th November 2025, php8.5 was released, but ionCube Loader for it is second beta release as at today.

    Server admin can already install php8.5 for their website and other usages as follows:
    Code:
    apt-get -y install php8.5 php8.5-cgi php8.5-cli php8.5-common php8.5-curl php8.5-fpm php8.5-gd php8.5-imap php8.5-intl php8.5-mbstring php8.5-memcached php8.5-mysql php8.5-phpdbg php8.5-pspell php8.5-readline php8.5-soap php8.5-sqlite3 php8.5-tidy php8.5-xml php8.5-xsl php8.5-zip
    
    Note we use memcached for it now but there is no opcache, as the later is now a part of php8.5 itself and no longer an optional module. Also add it to additional php section in ISPConfig System just like php8.4 tutorial suggests.

    Admin can also use beta version of ionCube Loader for php8.5 for website and other testing purposes and install it as follows:
    Code:
    # Donwload, extract & move respective Ioncube Loader .so file accordingly
    cd /tmp
    sudo  wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_beta.tar.gz
    sudo  tar xzf ioncube_loaders_lin_x86-64_beta.tar.gz
    cd ioncube
    if [ -e "ioncube_loader_lin_8.5.so" ]; then sudo cp -a ioncube_loader_lin_8.5.so /usr/lib/php/20250925/ioncube.so; fi
    
    # Create ioncube.ini & copy it to respective php module folder
    sudo  cat <<EOT >> ioncube.ini
    ; configuration for php ioncube module
    ; priority=10
    zend_extension=ioncube.so
    ioncube.enable=1
    EOT
    sudo  xargs -n 1 cp -v ioncube.ini<<<"/etc/php/8.5/mods-available/"
    
    # Enable Ioncube Loader & restart all php-fpm
    phpenmod ioncube
    if [ $(dpkg-query -W -f='${Status}' php8.5-fpm 2>/dev/null | grep -c "ok installed") -eq 1 ]; then sudo service php8.5-fpm restart; fi
    cd /root
    
    Again testing purposes only, not production, though it should already be good for some, so use it at your own risk and discretion.

    I will update the first post with ionCube Loader for php8.5 once it is released.
     
    Last edited: Jan 25, 2026

Share This Page