docker-nginx-php-mysql icon indicating copy to clipboard operation
docker-nginx-php-mysql copied to clipboard

Install custom extension for php

Open chalist opened this issue 4 years ago • 2 comments
trafficstars

How I can install custom extension like ioncube? Thank you.

chalist avatar Aug 23 '21 11:08 chalist

I just did it @chalist with the following steps.

Learn you PHP container id or label and replace containerid with the places i wrote ın this answer docker ps Example : {containerid} -> yakuter_php_1

Download ioncube: wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Extract it: tar xvfz ioncube_loaders_lin_x86-64.tar.gz

Find the suitable .so file with your PHP version in ioncube folder: Example: ioncube_loader_lin_7.4.so

Learn the extensions folder of PHP image: docker-compose exec php php -i | grep extension_dir Example: /usr/local/lib/php/extensions/no-debug-non-zts-20131226

Copy the extension file in to the image extension dir: docker cp ioncube_loader_lin_7.4.so {containerid}:/usr/local/lib/php/extensions/no-debug-non-zts-20131226

Then create a file outside and add this line in it: zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/ioncube_loader_lin_7.4.so

Save file with this name: docker-php-ext-ioncube.ini

Learn the ini files location with this command: docker-compose exec php php -i | grep 'additional .ini files' Example: /usr/local/etc/php/conf.d

Copy your new ini file into the image: docker cp docker-php-ext-ioncube.ini {containerid}:/usr/local/etc/php/conf.d

Then: docker-compose stop docker-compose start

To check ioncube enter this command: docker-compose exec php php -m

The last line for me is: the ionCube PHP Loader + ionCube24

yakuter avatar Nov 13 '21 09:11 yakuter

I think this extension installation process can be handled with make file @zanematthew @mkamranpk @phambanhan

yakuter avatar Nov 13 '21 09:11 yakuter