I have a Dockerfile that when used with my docker-compose commands works fine, I'd like to have this docker container built however as GRPC takes 15 mins to install every time I want to run tests in GitHub Actions
This is what my Dockerfile currently looks like:
FROM xxx-base:6
RUN pecl install grpc \
&& docker-php-ext-enable grpc \
WORKDIR /application
And I get the following error output:
#5 580.4 g++: fatal error: Killed signal terminated program cc1plus
#5 580.4 compilation terminated.
#5 580.4 make: *** [Makefile:248: src/core/ext/filters/client_channel/lb_policy/xds/cds.lo] Error 1
#5 580.5 ERROR: `make' failed
------
executor failed running [/bin/sh -c sudo pecl install grpc && docker-php-ext-enable grpc WORKDIR /application]: exit code: 1
It's worth mentioning in the base container used here I used pecl to install imagik so I know that command at least partially works. This is a base PHP 7.4 container.
Any suggestions, I've seen some other posts referring to the memory limit on the docker build, but I'm not sure what to change
Pastebin full stacktrace: pastebin.com/g7iZ2uRn
Installing GRPC in a pipeline takes a long time.
I recommend using the cache of the provider used (bitbucket, github etc ..) or using a base image which is used as the starting point of the Dockerfile
FROM baseimage:latest
I have implemented an image based on alpine and php 7.4 with extension grpc installed, check it on github gits click here
In case gcc –version says anything less than 4.9 ...this might be the cause.
This answer also seems to be related to your scenario... in case PECL fails.
Related
since the latest php fpm docker image update yesterday (https://hub.docker.com/_/php?tab=tags&page=1&name=fpm-alpine) my pipeline is broken because apparently PHP version 8 is installed instead of 7.4 as in my Dockerfile specified.
I am using this in my docker file:
FROM php:7.4-fpm-alpine AS ...
But according to my composer installs the container has PHP 8.0.13 running:
Root composer.json requires php 7.4.26 but your php version (8.0.13) does not satisfy that requirement.
Anyone an idea what is going on here?
As Jeremy Brooks already mentioned, Alpine released version 3.15 where composer requires PHP 8 (https://pkgs.alpinelinux.org/package/v3.15/community/x86_64/composer). Instead of installing composer from getcomposer.org another solution is to use Alpine 3.14:
FROM php:7.4-fpm-alpine3.14 AS ...
The alpine PHP images you reference do not include composer, so how are you installing it? If you are using apk to installer composer, it looks like the latest alpine composer package is pulling php8 in as a dependency, and this is causing your issue. What solved this issue for me was to install composer using the install script from getcomposer.org instead of using apk.
Assuming this is what you are doing, remove this from your Dockerfile:
RUN apk add composer
and add:
ADD https://getcomposer.org/installer ./composer-setup.php
RUN php ./composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN rm ./composer-setup.php
If composer is indeed included in your base image (unlikely), you could try uninstalling first:
RUN apk delete composer
and then add the above code to install it from the setup script instead.
Edit: adding the ignore-platform-reqs flag will probably get you past the error, but you are introducing a possible point of failure in the future if you have a composer package with a platform requirement. In that case, you won't know about the error until runtime. I would not recommend that approach. The method I posted above will install composer using the version of PHP already on the system and will not require risky workarounds.
I'm currently working on my docker-compose file to install laravel 8 with php 8.
I tested "php:7.4-fpm-alpine", and when I access the container I'm getting this version of php :
/var/www/html # php --version
PHP 7.4.26 (cli) (built: Nov 30 2021 08:21:51) ( NTS )
You can test it yourself :
docker container ls
docker exec -it <container_id> sh
php --version
I'm getting PHP 8.0.13 when installing "php:8.0-fpm-alpine"
Also I'm creating my laravel project using the composer image, I don't have php/composer installed locally. It's something you might have a look, because it could be quickly confusing ;-)
I had the same problem today...
Try:
composer install --no-scripts --ignore-platform-reqs
Fixed it for me.
Code and Idea are from
https://stackoverflow.com/users/564000/armin
I'm trying to spin up a laravel instance via lando using php8.
I also need to install the php GMP module...
I'm very new to docker and lando.
Now it seems as though the php instance that lando uses does not have GMP pre-setup
I found a post somewhere where someone installed some php modules via the lando file and tried to modify my file based on that.
This is my lando file at the moment:
name: og-tools
recipe: laravel
config:
webroot: public
composer_version: 2
database: mariadb
cache: redis
services:
appserver:
type: php:8.0
via: apache
build_as_root:
- apt-get update -y
- apt-get install php8.0-gmp
- echo "extension=gmp.so" > /etc/php8/apache2/conf.d/gmp.ini
mailhog:
type: mailhog
portforward: true
hogfrom:
- appserver
When I try running it I get the following:
E: Unable to locate package php8.0-gmp
E: Couldn't find any package by glob 'php8.0-gmp'
E: Couldn't find any package by regex 'php8.0-gmp'
ERROR ==> E: Couldn't find any package by regex 'php8.0-gmp'
However looking up PHP8 GMP searches lead me to this site: https://websiteforstudents.com/how-to-migrate-to-php-8-0-on-ubuntu/
They mention the package php8.0-gmp however I don't seem to be able to find it.
I could just be doing this all completely wrong, I'm a little out of my depth for the time being and trying to learn as I go
Thanks to one of the guys over on the lando slack, this is the solution he gave me which works:
services:
appserver:
build_as_root:
- apt update && apt install libgmp-dev -y && docker-php-ext-install gmp
For this installation:
Nginx 1.11.10
Yii Framework 2.0.12 ("yiisoft/yii2-mongodb": "^2.0")
PHP MongoDB library (mongodb 1.2.9, compatible with PHP Version: PHP 5.4.0 or newer)
PHP 5.4.16
Plesk Onyx 17.0.17
No IPTables rules
Strangely enough they function when you visit the website the first time. I can also see data pulled from the Mongo database. But when visiting another page within 10-20 seconds, this error will appear:
25403#0: *170 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'MongoDB\Driver\Query' not found in /var/www/vhosts/website.com/website.com/vendor/yiisoft/yii2-mongodb/Command.php on line 284" while reading response header from upstream
PHP Fatal Error – yii\base\ErrorException
Class 'MongoDB\Driver\Query' not found
1. in /var/www/vhosts/website.com/website.com/vendor/yiisoft/yii2-mongodb/Command.php at line 284
try {
$this->beginProfile($token, __METHOD__);
$query = new \MongoDB\Driver\Query($this->document, $options);
However, if you wait another 10-20 seconds, the website works just fine.
I solved it in a yii2 docker alpine nginx image, doing this:
FROM local/dmstr/php-yii2:latest-alpine-nginx
RUN apk --update add autoconf g++ make && \
pecl install mongodb
RUN echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
You must install mongodb and then create an ini file for the extension on your system's php extensions directory, like I did. Remember to put extension=mongodb.so on it.
First time puppet user, and I'm having trouble getting an install of a specified version of PHP using Vagrant. I'm using the example42/php module, and I keep running into ensure problems.
Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install php-5.5.12' returned 1: Error: Nothing to do
Error: /Stage[main]/Php/Package[php]/ensure: change from absent to 5.5.12 failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install php-5.5.12' returned 1: Error: Nothing to do
Warning: /Stage[main]/Php/File[php.conf]: Skipping because of failed dependencies
spits out of my console, followed by another attempt that's identical.
My .pp file I'm provisioning with:
class lamp {
# package {'php':
# ensure => present,
# }
}
node 'node1' {
include lamp
file { '/php':
ensure => directory,
# I read that I may need to have a directory in order for the install to work...
}
class { 'php':
version => '5.5.12',
}
}
As far as I can tell, I'm referencing correctly to the modules, which I store inside /puppet/modules/ and it's finding them, but I'm having a hard time getting a specific version of PHP to install. I could use a very simple "getting started LAMP" for Puppet but that only install 5.3.3 even if I ensure => latest,
The puppet module only uses your system's package manager (yum) to download specific php packages. If it cannot find the required packages, it will not work. 5.3.3 is latest version in your repository, so it install that. I wouldn't be surprised if this is the only version of php available in your repositories.
You need to configure yum with some repositories which have the required PHP packages and then try the puppet module with that.
I'm having trouble building hiphop under Backtrack 5. I have installed all the essentials and apparently the only part that it keeps failing at is the custom libevent package.
Here are the commands I'm running in order to build and install libevent.
wget http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
tar -xzvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable
cp ../hiphop-php/src/third_party/libevent-1.4.14.fb-changes.diff .
patch -p1 < libevent-1.4.14.fb-changes.diff
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
When building libevent it builds and installs with no errors. When attempting to build hiphop these are the commands I am running:
cd hiphop-php
git submodule init
git submodule update
cmake -D CMAKE_PREFIX_PATH=`/bin/pwd`/../ .
However when running CMAKE I get this error:
CMake Error at CMake/HPHPFindLibs.cmake:65 (message):
Custom libevent is required with HipHop patches
Does anyone know a way to fix this problem or at least point me in the right direction?
EDIT:
I forgot to mention this, but every time I attempt to patch the libevent source I get this message:
patch -p1 < libevent-1.4.14.fb-changes.diff
patching file event.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Here I usually just answer yes and allow it to proceed
I had the same problem for a while.
Following the steps above surely installs the libevent correctly.
Although the site in not clear, this error may be caused by misdirecting the cmake path.
For example, I saved hiphop in the following path: /dev/, and the libevent in the path: /.
So, I had to set the following:
CMAKE_PREFIX_PATH=/