nanoninja / docker-nginx-php-mysql

Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
1.76k stars 867 forks source link

Install custom extension for php #57

Open chalist opened 3 years ago

chalist commented 3 years ago

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

yakuter commented 2 years ago

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 commented 2 years ago

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