Trying to install IonCube Loader on PHP 7.4 on Azure App Service Linux

Jake Slagle 1 Reputation point
2021-01-05T04:44:20.683+00:00

Hi All,

I am trying to install IonCube Loader on an Azure App Service Linux instance. I have followed all the instructions on customizing the PHP_INI_SYSTEM directives and enabling PHP extensions. While IonCube is loading in, my web app fails to start and I get :( Application Error. I check the logs and here is what I get:

2021-01-05T04:36:29.101705544Z [05-Jan-2021 04:36:29 UTC] PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0

Zend extension opcache is loading before ioncube which is causing this error. Trouble is, I can't figure out how to get around this. Most of the guides on the web are for a windows environment. The application I need to run must be hosted in a Linux environment for support by the company.

Any suggestions? I even was able to get ioncube to run on a windows environment and while I am sure the app would run fine I would rather have it hosted in a Linux environment.

Jake

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Prasit Narkdee 11 Reputation points
    2022-07-18T15:21:26.037+00:00

    (Google translate)

    I just had the opportunity to use Azure Web App and have a PHP script that uses Ioncube Loader to compile and I encountered the same problem. Same solution as @Anonymous answered. but would like to expand further It might be easier to understand.

    I use Azure Web App (Linux) + PHP 7.4.

    1. Go to download ioncube loader ( Linux (64 bits) ) from https://www.ioncube.com/loaders.php.
    2. extract ioncube_loaders_lin_x86-64.tar.gz

    Upload php extension file ioncube_loader_lin_7.4.so

    1. ftp to Azure Web App server
    2. At the path /site
    3. create folder php-ext
    4. upload ioncube_loader_lin_7.4.so to this path
    5. You will get file path /home/site/php-ext/ioncube_loader_lin_7.4.so

    Create custom php ini file named 00-ioncube-loader.ini contain

    zend_extension=/home/site/php-ext/ioncube_loader_lin_7.4.so
    
    1. ftp to Azure Web App server
    2. At the path /site
    3. create folder php-ini
    4. upload 00-ioncube-loader.ini here
    5. You will get the file path /home/site/php-ini/00-ioncube-loader.ini

    Create startup.sh script file contain

    #!/bin/bash
    cp -a /home/site/php-ini/00-ioncube-loader.ini /usr/local/etc/php/conf.d/
    
    1. ftp to Azure Web App server
    2. At the path /site
    3. create folder sh-script
    4. upload startup.sh to here
    5. You will get file path /home/site/sh-script/startup.sh

    Add startup command to Azure Web App

    sh /home/site/sh-script/startup.sh
    

    221865-image.png

    2 people found this answer helpful.
    0 comments No comments

  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2021-01-05T19:41:06.377+00:00

    anonymous userlagle-8994, Thanks for posting this good question.

    I understand you have already added PHP extensions and customizing PHP.INI. If you haven't done this already, please add a bin directory to the root directory of your app and put the .so extension files in it and add a Startup script (step 3).
    Configure Custom runtime in php.ini: https://learn.microsoft.com/azure/app-service/web-sites-php-configure (how-to- use-a-custom-php-runtime) (Azure App Service Linux)

    Users facing similar issue rectified the problem by following these steps (I understand you have already gone through a couple of steps here), please review and try the steps and let us know how it goes:

    1.**Create a **php.ini file with the following content under /home/site:

    Kindly modify the location of ".so" file as per your WebApp.
    You can copy the files in any location under /home.
    If the file is under /home/site, the ini file should have -> zend_extension=/home/site/ioncube_loader_lin_7.4.so, for example.]

    2.Create a startup file, example (start.sh). At this, you can copy the php.ini in the previous step to /usr/local/etc/php.
    Note: We are using a startup script since the files which are not under /home will not persist when the WebApp is restarted

    3.**Configure this **startup script from Configurations blade of the WebApp, so that the script runs when the container starts:
    53666-image.png

    4.If feasible, restart the WebApp and verify using php -v command – to verify if the extensions are loaded.

    Note: The best way to see the PHP version and the current php.ini configuration is to call phpinfo in your app.

    Kindly checkout these doc for additional info:

    Install ionCube Loader extension for PHP site on Azure App : https://learn.microsoft.com/archive/blogs/azureossds/install-ioncube-loader-extension-for-php-site-on-azure-app (Old blog, similar steps works).

    You may try the step-by-step process on adding PHP extensions on Azure App Service Linux in the article below:
    https://learn.microsoft.com/azure/app-service/configure-language-php?pivots=platform-linux#enable-php-extensions (Azure App Service Linux)

    Kindly let us know how it goes, I'll follow-up with you further.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.