Install XML-RPC in PHP8 Dockerfile - php

I have this Dockerfile:
FROM php:8.1.0-fpm
RUN apt-get update \
&& apt-get install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip libpng-dev libssl-dev libxslt-dev wkhtmltopdf procps acl \
&& pecl install apcu \
&& docker-php-ext-install intl opcache pdo pdo_mysql zip gd xsl -j$(nproc) \
&& docker-php-ext-enable apcu opcache \
&& docker-php-ext-configure zip
# xmlrpc
# channel://pecl.php.net/xmlrpc-1.0.0RC3
# php-xmlrpc
# php-xml-rpc
# php8.1-xmlrpc
# php-pecl-xmlrpc
# php81-pecl-xmlrpc
# xmlrpc-1.0.0RC3
I've tried so many ways to include XML-RPC in there (c.f. commented lines) but nothing's working. I know it's not recommended to use this package but it's a dependency that I absolutely need. It worked fine in PHP 7.4, but I can't figure it out for PHP 8.1.
Can anyone clue me in please?

Add this command
RUN pecl install channel://pecl.php.net/xmlrpc-1.0.0RC3 xmlrpc
and do not forget to add "extension=xmlrpc.so" to php.ini file.

Related

PHP Graphical Library with Docker in Ubuntu

I have Docker with php and mysqli, and I'm trying to put the graphical library in my Ubuntu 20.04.3 LTS.
These are the lines in my PHP.Dockerfile:
FROM php:fpm
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN docker-php-ext-install pdo pdo_mysql
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
libonig-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd \
&& docker-php-ext-enable gd
RUN pecl install xdebug && docker-php-ext-enable xdebug
When i run Docker-Compose up and open the php file with the captcha it shows me that fail. The refered lines are the ones of the captcha.
All my partners use Linux Mint, and it works in their machines, so i dont know why it doesnt work in my Ubuntu
Does someone know what am I doing wrong? I dont know what to do to run the graphical librarys (for captchas, graphics...) with docker
SOLVED:
I changed the old PHP.Dockerfile file and now it works!!
The problem was the version PHP in Ubuntu.
First I deleted all the *.pem from mysqldata, and then I used this lines in the PHP.Docker
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN docker-php-ext-install pdo pdo_mysql
RUN pecl install xdebug && docker-php-ext-enable xdebug
Then I executed docker-compose build. And all is good now

Docker / Symfony / MongoDB - Cannot install mongodb with PHP 5.6 FPM

I'm not able to install mongodb extension using php:5.6-fpm image.
What's wrong with my Dockerfile configuration ?
FROM php:5.6-fpm
RUN apt-get update \
&& mkdir -p /usr/share/man/man1 \
&& mkdir -p /usr/share/man/man7 \
&& apt-get install -y --no-install-recommends vim curl debconf subversion git apt-transport-https apt-utils \
build-essential locales acl mailutils wget zip unzip htop vim \
gnupg gnupg1 gnupg2 \
libmemcached-dev zlib1g-dev \
libcurl4-openssl-dev pkg-config libssl-dev libicu-dev g++
RUN docker-php-ext-configure intl
RUN docker-php-ext-install pdo pdo_mysql zip intl
RUN pecl install mongodb
RUN docker-php-ext-enable mongodb
COPY php.ini /usr/local/etc/php/conf.d/php.ini
...
...
I have the following error when executing docker-compose build
Step 5/18 : RUN pecl install mongodb
---> Running in 5cd13b1b969c
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/mongodb requires PHP (version >= 7.0.0, version <= 7.99.99), installed version is 5.6.40
No valid packages found
install failed
Solution:
RUN pecl install mongodb-1.7.4

Is this the correct way to install php-intl using docker?

This never gets installed on my Github Actions even though I added intl in the end.
FROM composer:1.9.0
LABEL repository="https://github.com/ubient/laravel-vapor-action"
LABEL homepage="https://github.com/ubient/laravel-vapor-action"
LABEL maintainer="Claudio Dekker <claudio#ubient.net>"
# Install required extenstions for laravel
# https://laravel.com/docs/6.x#server-requirements
RUN apk add libxml2-dev libpng-dev && \
docker-php-ext-install bcmath xml tokenizer mbstring gd intl
# Install Vapor + Prestissimo (parallel/quicker composer install)
RUN set -xe && \
composer global require hirak/prestissimo && \
composer global require laravel/vapor-cli && \
composer clear-cache
# Install Node.js (needed for Vapor's NPM Build)
RUN apk add --update nodejs npm
# Prepare out Entrypoint (used to run Vapor commands)
COPY vapor-entrypoint /usr/local/bin/vapor-entrypoint
ENTRYPOINT ["/usr/local/bin/vapor-entrypoint"]
This fixed it
# Install INTL
RUN apk add icu-dev
RUN docker-php-ext-configure intl && docker-php-ext-install intl
https://github.com/aligajani/laravel-vapor-action/

Why won't Docker load Tidy?

I'm trying to use phpdocx in order to create a docx file from HTML in a laravel api application.
In order to use this conversion tool, it is necessary to have Tidy installed.
I've included tidy in dockerfile like so
FROM php:7.2-fpm-stretch
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libicu-dev \
openssh-client\
git \
curl \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
tidy \
libfreetype6-dev \
libssl-dev \
libmcrypt-dev \
gnupg \
&& rm -rf /var/lib/apt/lists/*
but when I add a phpinfo(); to my code, tidy is no where to be found.
What is strange is that when I access the bash of docker, I can tidy -v and i get HTML Tidy for Linux version 5.2.0
I have uncommented extension=php_tidy.dll in all the php.ini files associated with the project, and have rebuilt the image numerous times.
When I run check.php included in phpdocx I can find this error in the result Warning You must install Tidy for PHP if you want to use embedHTML in your Word documents.
I've tried docker pull imega/tidy to no avail.
I've been stuck on this for over a day now, if anyone has any idea where I'm going wrong I would appreciate the help.
root#c790d433727a:/var/www/vendor/phpdocx# php check.php
OK PHP version is 7.2.22
OK Zip support is enabled.
OK DOM support is enabled.
OK XML support is enabled.
Warning You must install Tidy for PHP if you want to use embedHTML in your Word documents.
OK mbstring is enabled.
root#c790d433727a:/var/www/vendor/phpdocx# tidy -v
HTML Tidy for Linux version 5.2.0
See an example Docker file:
FROM php:7.2-fpm-stretch
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get install -y libtidy-dev
RUN docker-php-ext-install -j$(nproc) tidy
if you build it this way:
docker build --tag stackoverflow .
and run this way:
docker run --rm -it --entrypoint="" stackoverflow /bin/sh
you will be logged into CLI and may check installed extensions this way:
php -m
that gives list:
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tidy
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
with:
tidy
under:
[PHP Modules]
Have fun with it :)
I faced the same problem few days ago, problem was not only tidy library self but missed other tidy dependency libtidy-dev, this works perfectly to install and load tidy:
# Install system dependencies
RUN apt-get update && apt-get install -y \
nano \
libxml2-dev \
libzip-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libmagickwand-dev \
**libtidy-dev** \
git \
curl \
zip \
ssh\
wget\
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install \
exif \
gd \
soap \
zip
RUN docker-php-ext-install tidy \
&& docker-php-ext-enable tidy

Setting up docker on Mac OS - php-intl cannot be installed

I have the following problem:
I want set up a development environment on my Mac using docker and boot2docker.
For that I created an image using the below Dockerfile.
The Problem is, that my php-intl-Extension cannot be installed.. I tried various method. For example to enable it in php.ini via:
extension=php_intl.so
None of the methods will work. Here is the content of my Dockerfile:
FROM php:5.5-apache
# use own php.ini file
COPY config/php.ini /usr/local/etc/php/
# get some php-extensions
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu52 \
libicu-dev \
zlib1g-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN apt-get update && apt-get install -y libmemcached-dev \
&& pecl install memcached \
&& docker-php-ext-enable memcached
# Install intl (not working yet):
RUN pecl install intl
# use own src file
COPY src/ /var/www/html/
Can anyone help? That would be so great, because this problem takes a lot of time by now. Thanks in advance!!!
You don't need to use PECL, why don't you just use:
docker-php-ext-install intl
Generally you also need to apt-get install libicu-dev for dependencies, but you already have that.

Categories