I am having problems installing yaml support on my php docker configuraiton.
Here is my dockerbuild file:
FROM php:7.2.2-apache
RUN docker-php-ext-install mysqli
# Install YAML extension
RUN pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini && docker-php-ext-enable yaml
But I am getting error:
configure: error: Please install libyaml
I googled, but haven`t found working solution yet. Any ideas how should I do it?
Note:
RUN apt-get install libyaml
Havent worked, got message E: Unable to locate package libyaml
And also this command havent worked:
yum install libyaml-devel
error: yum install libyaml-devel
First you need to run the update and then install the required package that is libyaml-dev.
FROM php:7.2.2-apache
RUN docker-php-ext-install mysqli
# Install YAML extension
RUN apt-get update -y
RUN apt-get install libyaml-dev -y
RUN pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini && docker-php-ext-enable yaml
How do I install the yaml package for Python?
I found also different way, maybe for someone easier because adding php extension is really simple.
https://github.com/mlocati/docker-php-extension-installer
And here is my final Dockerfile
FROM php:7.2.2-apache
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions mysqli yaml
Related
I'm writing some unit tests for our application and we're using GitLab CI with GitLab Runner v11.11.1 and using Docker executor with image php:7.1.
When running composer install (our composer version is 1.10.17) I get the following error on a few required packages:
the requested PHP extension gd is missing from your system
I've tried a couple things like on our gitlab-ci.yml:
apt-get update -yqq
apt-get install -yqq libpng-dev
But that also produced the same error.
I also tried requiring ext-gd from the composer.json file:
composer require ext-gd
But I got this error:
The requested PHP extension ext-gd ^7.1 is missing from your system. Install or enable PHP's gd extension.
The last attempt I made was:
apt-get install php-common
phpenmod gd
But this gave me this error:
Unable to locate package php-common
Does anyone know how to simply enable the PHP extension gd so I can run my unit tests?
I fixed the errors when I added this to my gitlab-ci.yml file:
...
before_script:
- apt-get update -yqq
- apt-get install libjpeg-dev libpng-dev -yqq
- docker-php-ext-install gd
...
You need PHP GD library. For Debian and Debian based systems, e.g. Ubuntu, as well as Debian based Docker containers use:
apt-get install -qy php-gd
If it's still unclear, or you have older/other system just search
apt-cache search php gd
and will find out possible package candidates.
For Docker containers it seems you need a different route, so Dockerfile:
FROM php:7.1-apache-buster
RUN apt-get update
RUN apt-get upgrade -qqy
RUN php -v
RUN apt-get install -qy libpng-dev
RUN docker-php-ext-install gd
I want to install php-zip on my docker image (the end goal is to use the PhpWord Library). I use the php:7.4-fpm, which runs on Debian.
In my dockerfile, i use the command :
RUN apt-get update docker-php-ext-install zip
When executed, the script crashes because it can't find /usr/src/php/ext/libzip.
So i add a good old "apt-get install libzip", but it can't locate the package. Same thing if it try to install "libzip4" :
checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
No package 'libzip' found
No package 'libzip' found
No package 'libzip' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBZIP_CFLAGS and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'webapi' failed to build : The command '/bin/sh -c apt-get update && apt-get install libzip4 && docker-php-ext-install zip' returned a non-zero code: 1
I assume either libzip4 isn't a valid version or it can't make the link between libzip and libzip4.
The main issue is that, without that library, i'm stuck and can't install the extension at all. Also i'm quiet a rookie when it comes to docker so i call out your help !
Thanks for your time !
Ok, so the issue is that you have to guess that the package you need to install is called "libzip-dev", not just "libzip".
So the solution was :
RUN apt-get update \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip
I'm trying to install php on Centos 7 following instructions from: https://www.php.net/manual/en/install.unix.nginx.php.
My nginx version: nginx/1.19.0
I downloaded php-7.4.6.tar.gz from https://www.php.net/downloads
but
at the step:
./configure --enable-fpm --with-mysqli
I got this error:
checking for sqlite3 > 3.7.4... no
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
No package 'sqlite3' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables SQLITE_CFLAGS
and SQLITE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I do have sqlite3 up and running:
# sqlite3
SQLite version 3.7.17
So, how should I set the environment variable (in configure file?)?
Thanks!
To compile from source, dependencies need to be available as a linkable library (and sometimes headers which the new program uses for building). -devel packages install these libraries, so to build PHP from source with SQLite support, you need to install sqlite-devel.
If you have Ubuntu >= 20.04, install this package libsqlite3-dev to satisfy the dev dependency/package requirements.
sudo apt install libsqlite3-dev will work. To know which libraries to install you may find apt search sqlite3 useful.
for ubuntu21.04 I needed to use sudo apt install libsqlite3-dev
sudo apt-get install -y libbz2-dev sqlite3 libsqlite3-dev libssl-dev libcurl4-openssl-dev libjpeg-dev libonig-dev libreadline-dev libtidy-dev libxslt-dev libzip-dev
The command sudo apt-get install sqlite3 works for ubuntu.
On Ubuntu 22.04 I had the same problem after installing :-
sudo apt-get install sqlite3 libsqlite3-dev
To get round this :-
sudo find / -name sqlite3.pc
Then add the folder that contains that file to :-
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/
I've installed PHP:latest Docker container using the docker-compose command. It installed php-7.1.6-fpm in my Docker. When I tried to install php7-pgsql extension it failed to find that package, instead found pdo and pdo_pgsql packages. That will not satisfy my need. When I search for the available packages in the installed PHP container, I could not find any related pgsql packages for php7, instead, I saw php5-pgsql package, that will not work with php7-fpm.
Finally, I installed php-5.6-fpm container after removing the old one targeting to use php5-pgsql package. But now I disappointed again that I could not find php5-pgsql package in the newly installed container.
I know I'll be missing some important points. Whether Alpine Linux does not have php-pgsql extension. What are the possible ways to include this extension in my PHP container. I've also included Nginx and Postgres in my docker-compose.yml
I've only 3-day theory knowledge in Docker and first-day practical experience.
Thanks for reading.
I ran into the same issue when I was settings up a new project to use pgsql.
I am using php7, so you should be able to use it as well. On your Dockerfile ensure you're covering the following steps.
Ensure you have the dependencies installed:
RUN apt-get update && apt-get install -y libpq-dev
Configure the extension:
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
Install the extension:
RUN docker-php-ext-install pdo pdo_pgsql
This is an old question i know, but i ran into this today and believe the above solution has changed with php:7.4-fpm-alpine
So where it used to be:
RUN apt-get update && apt-get install -y libpq-dev
Should now be:
RUN apt-get update && apt-get install -y postgresql-dev
Hopefully this helps anyone that runs into the same issue.
When I try to install php 5.3 stable from source on Ubuntu (downloading compressed installation file from http://www.php.net/downloads.php) and I run ./configure I get this error:
configure: error: xml2-config not found. Please check your libxml2 installation.
All you need to do instal install package libxml2-dev for example:
sudo apt-get install libxml2-dev
On CentOS/RHEL:
sudo yum install libxml2-devel
For the latest versions it is needed to install libxml++2.6-dev like that:
apt-get install libxml++2.6-dev
I had the same issue when I used a DockerFile.
My Docker is based on the php:5.5-apache image.
I got that error when executing the command RUN docker-php-ext-install soap
I have solved it by adding the following command to my Dockerfile:
RUN apt-get update && apt-get install -y libxml2-dev
Ubuntu, Debian:
sudo apt install libxml2-dev
Centos:
sudo yum install libxml2-devel
this solution it gonna be ok on Redhat 8.0
sudo yum install libxml2-devel
OpenSuse
"sudo zypper install libxml2-devel"
It will install any other dependencies or required packages/libraries