0

I'm using DDEV to develop an OXID Esales Project. It's very comfortable to work with but now I have to install the Ioncube Loader. How can I do that? I have to put the .so file into the php direction inside the container and extend the php.ini. But I don't know how? Can someone help me?

Project: OXID E-Sales

  • php7.1
  • mysql5.7
  • MacOS
  • DDEV
rfay
  • 9,963
  • 1
  • 47
  • 89
  • Welcome @Florian - Since Ioncube seems to be a commercial product and supports only obsolete versions of PHP, you may not be able to find enough help here. But to add PHP configuration to DDEV-Local, follow the docs in [Providing custom PHP configuration](https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#providing-custom-php-configuration-phpini). – rfay Aug 13 '20 at 12:11
  • Installing is trivial and although @rfay didn't spot it, Loaders for all current releases of PHP and older are available across a large number of platforms. There's an "install in under 60 seconds" video here https://www.youtube.com/watch?v=Bp5ce9-LQKg that shows the basic idea. – Nick Aug 13 '20 at 13:30

1 Answers1

3

[Note: This will never work on arm64 machines like the Mac M1, because ioncube provides only amd64/x86-64 binaries for their extension. If you need to bring something back to life from the past you can do it in the amd64 environment of gitpod.io for example.]

You could do this manually inside the web container each time you did a ddev start, but that doesn't sound like much fun.

Instead, we'll incorporate all the required changes into the add-on Dockerfile see docs.

Put these contents in your project's .ddev/web-build/Dockerfile and then it will (one time) build up your ddev-webserver image with the ioncube .so loader you need and the PHP configuration you need. This is for PHP 7.1 as you said, you'd change the PHP_VERSION for some other version.

ARG BASE_IMAGE
FROM $BASE_IMAGE

# Install the ioncube loader - set the PHP_VERSION to what you need
ENV PHP_VERSION=7.1
RUN mkdir -p /usr/local/lib && curl -sSlL  -o /tmp/ioncube.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz && tar -x --strip-components=1 -C /usr/local/lib -f /tmp/ioncube.tar.gz ioncube/ioncube_loader_lin_${PHP_VERSION}.so

# The ioncube_loader has to be the very first thing in the php.ini, so insert it there.
ENV PHP_INI_PATH=/etc/php/${PHP_VERSION}/fpm/php.ini
RUN (echo 'zend_extension = /usr/local/lib/ioncube_loader_lin_${PHP_VERSION}.so' && cat ${PHP_INI_PATH}) > ${PHP_INI_PATH}.new && mv ${PHP_INI_PATH}.new ${PHP_INI_PATH}
rfay
  • 9,963
  • 1
  • 47
  • 89
  • 1
    Wow :-) Thank you. It work. Exactly the solution I've searched for :) – Florian Schütt Aug 14 '20 at 06:43
  • Maybe u can help me again. For an older OXID shop I need to install the zendguardloader in the same way like above. – Florian Schütt Jan 21 '21 at 14:36
  • If you have a new question, please make a new question with full details. – rfay Jan 21 '21 at 20:35
  • https://stackoverflow.com/questions/65852763/ddev-integration-zendguard-loader – Florian Schütt Jan 22 '21 at 21:06
  • @rfay I changed PHP_VERSION to 7.4, but when checking with `ddev exec php --version` after starting the ddev project, it does not show ionCube. In the ddev logs I see this entry `Failed loading /usr/local/lib/ioncube_loader_lin_7.4.so: /usr/local/lib/ioncube_loader_lin_7.4.so: cannot open shared object file: No such file or directory` – Nick Weisser Feb 09 '22 at 13:55
  • Hi @NickWeisser - The way to study the problem you're having is to `ddev ssh` and execute the instructions one at a time and see what happens. But reading https://www.ioncube.com/ suggests to me that ioncube doesn't run above php7.2, not sure. – rfay Feb 11 '22 at 00:23