Cannot install laravel/cashier on docker because of dompdf - laravel

Project using docker php:7.1-fpm image to run my laravel application.
When installing laravel/cashier through prooph/composer:7.2, it throws an error:
Problem 1
- laravel/cashier v7.1.0 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- laravel/cashier v7.1.1 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- dompdf/dompdf v0.8.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for laravel/cashier ^7.1 -> satisfiable by laravel/cashier[v7.1.0, v7.1.1].
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/php.ini
- /usr/local/etc/php/conf.d/amqp.ini
- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
- /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-soap.ini
- /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
- /usr/local/etc/php/conf.d/mongodb.ini
- /usr/local/etc/php/conf.d/php7.ini
- /usr/local/etc/php/conf.d/redis.ini
- /usr/local/etc/php/conf.d/zmq.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
Here is my dockerfile content:
FROM php:7.1-fpm
RUN echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list &&\
curl -L http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb -o /deb-multimedia-keyring.deb &&\
dpkg -i /deb-multimedia-keyring.deb
RUN apt-get update && apt-get install -y \
libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev cron libcurl3 imagemagick libav-tools python
RUN docker-php-ext-configure mcrypt && \
docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql opcache && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install -j$(nproc) gd
RUN echo "* * * * * root php /var/www/tidytide/artisan schedule:run &> /var/log/cron.artisan" >> /etc/crontab
WORKDIR /var/www/tidytide
COPY --chown=www-data:www-data . .
COPY ./entrypoint.sh /
ENTRYPOINT /entrypoint.sh
The problem is that cashier requires dompdf package, which requires gd library enabled on php. GD library is installed through dockerfile, and as I see that dompdf doesn't observe this.

If you're using different container (and different PHP version) for composer installation, you should probably use platform settings in your composer.json to mimic configuration of container where you actually run your app:
"config": {
"platform": {
"php": "7.1",
"ext-gd": "*"
}
},
Composer will act like you're using PHP 7.1 with GD extension enabled, even if your actually using PHP 7.2 without this extension for running Composer.

Related

Install Imagick in Laravel Sail (Docker)

I am trying to install Imagick PHP Extension in Laravel Sail but I am failing to do so.
Details:
Laravel 9
PHP 8.2
In the Dockerfile (in directory docker/8.2) I added this snippet to the script:
RUN apt-get update; \ # Imagick extension apt-get install -y libmagickwand-dev; \ pecl install imagick; \ docker-php-ext-enable imagick; \ # Success true
Did run sail build and it runs the script without errors but it does not detect Imagick
Solved. I forgot to point to the published Dockerfile in docker-composer.yml. :/

laravel CI / CD Development

Can anyone point me in the right direction for the Laravel CI/CD Development in code commit AWS?
I have gone through a lot of tutorials but always fail to connect the Database to either elastic beanstalk or EC2,
Can someone recommend a good tutorial for this
This is my build Command.
version: 0.2
phases:
install:
runtime-versions:
php: 7.4
nodejs: 12.x
commands:
- apt-get update -y
- apt-get install -y libpq-dev libzip-dev
- apt-get install -y php-pgsql
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
pre_build:
commands:
- cp .env.beta .env
- composer install
- npm install
build:
commands:
- npm run production
- php artisan migrate --force
- php artisan db:seed
artifacts:
files:
- '**/*'
name: $(date +%Y-%m-%dT%H:%M:%S).zip
proxy:
upload-artifacts: yes
logs: yes
now i am getting ngnix 404 error,Even after adding " /public " in beanstalk

How do I get this to work in a docker environment - missing ext-zip extension

I am stuck with these errors for days and I have tried quite a couple of Dockerfile configurations.
Versions
PHP version: 7.3
Laravel version: ^6.2
Package version: ^3.1
Description
Exact errors
Problem 1
- Installation request for phpoffice/phpspreadsheet 1.11.0 -> satisfiable by phpoffice/phpspreadsheet[1.11.0].
- phpoffice/phpspreadsheet 1.11.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
Problem 2
- phpoffice/phpspreadsheet 1.11.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- maatwebsite/excel 3.1.19 requires phpoffice/phpspreadsheet ^1.10 -> satisfiable by phpoffice/phpspreadsheet[1.11.0].
- Installation request for maatwebsite/excel 3.1.19 -> satisfiable by maatwebsite/excel[3.1.19].
To enable extensions, verify that they are enabled in your .ini files:
-
- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
- /usr/local/etc/php/conf.d/docker-php-ext-exif.ini
- /usr/local/etc/php/conf.d/docker-php-ext-gd.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
My Dockerfile
FROM php:7.3-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev
RUN apt-get update && \
apt-get install -y \
libzip-dev \
&& docker-php-ext-install zip
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
# Set working directory
WORKDIR /var/www
USER $user
# Run migration?
As I experienced, sometimes it is so confusing to install a php extension.
Fortunately there is an awesome repository(docker-php-extension-installer) for doing it painlessly:
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions zip
Also you can add any extensions without concerning about the dependencies.
I tried a number of solutions I found and none worked for me -- including this one. I had to resort to editing the php.ini inside of the docker container and specifying which extensions I wanted to use. I don't think it was a problem of extensions not being installed, but the php.ini was not being updated properly for some reason.
Here Is the article that helped me find php.ini
This was for the PHP:8.0.3-fpm-buster docker image.

Vendor folder not being generated despite being run in AWS CodeBuild

When loading my AWS Elastic Beanstalk test website using CodeBuild continual deployment, I get this error:
Warning: require(/var/app/current/clu/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/app/current/clu/public/index.php on line 24 Fatal error: require(): Failed opening required '/var/app/current/clu/public/../vendor/autoload.php' (include_path='.:/usr/share/pear7:/usr/share/php') in /var/app/current/clu/public/index.php on line 24
It seems like the composer files are not being generated.
However, in the CodeBuild logs, they are.
[Container] 2020/02/24 03:21:34 Running command composer install
03:21:38
Loading composer repositories with package information
03:21:38
Installing dependencies (including require-dev) from lock file
03:21:38
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
03:21:38
Package operations: 89 installs, 0 updates, 0 removals
03:21:38
- Installing doctrine/inflector (v1.3.0): Downloading (connecting...)Downloading (100%)
03:21:38
- Installing doctrine/lexer (1.1.0): Downloading (connect..
...
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
Discovered Package: [32mfacade/ignition[39m
Discovered Package: [32mfideloper/proxy[39m
Discovered Package: [32mlaravel/tinker[39m
Discovered Package: [32mnesbot/carbon[39m
Discovered Package: [32mnunomaduro/collision[39m
[32mPackage manifest generated successfully.[39m
This is my buildspec.yml code:
version: 0.2
phases:
install:
commands:
export DEBIAN_FRONTEND=noninteractive
#Install php7.1
apt-get update
apt-get install -y software-properties-common
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
apt-get update
# Install PHP
apt-get install -y php7.2\
php7.2-ldap \
php7.2-xml \
php7.2-xmlrpc \
php7.2-zip \
php7.2-mysql \
php7.2-mbstring \
php7.2-mcrypt \
php7.2-gd \
php7.2-readline \
php7.2-opcache \
php7.2-xdebug \
php7.2-dom \
php-xdebug \
php7.2-curl \
unzip
phpenmod xdebug
#Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php ;
php -r "unlink('composer-setup.php');" ;
mv composer.phar /usr/local/bin/composer
build:
commands:
- echo Build started on `date`
- echo Installing composer deps
- composer install
post_build:
commands:
- echo Build completed on `date`
My laravel filesystem does not have the vendor folder as I would like it to be generated via composer install.
Would greatly appreciate a hand, i've tried so many things.. cant get it to generate properly.
I've also checked via ssh and the folder is not there grrr. Its like its being generated elsewhere.
Thanks!
Adding the following to my buildspec.yml enabled the vendor file to be uploaded to the working server.
artifacts:
files:
- '**/*'
proxy:
upload-artifacts: yes
logs: yes

laravel Installation failed, deleting ./composer.json

hi In Laravel Installation
The following error occurred
user#user-System-Product-Name:/$ composer global require "laravel/installer"
Changed current directory to /home/user/.config/composer
Using version ^2.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.1/cli/php.ini
- /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.1/cli/conf.d/10-opcache.ini
- /etc/php/7.1/cli/conf.d/10-pdo.ini
- /etc/php/7.1/cli/conf.d/20-calendar.ini
- /etc/php/7.1/cli/conf.d/20-ctype.ini
- /etc/php/7.1/cli/conf.d/20-exif.ini
- /etc/php/7.1/cli/conf.d/20-fileinfo.ini
- /etc/php/7.1/cli/conf.d/20-ftp.ini
- /etc/php/7.1/cli/conf.d/20-gettext.ini
- /etc/php/7.1/cli/conf.d/20-iconv.ini
- /etc/php/7.1/cli/conf.d/20-json.ini
- /etc/php/7.1/cli/conf.d/20-mcrypt.ini
- /etc/php/7.1/cli/conf.d/20-mysqli.ini
- /etc/php/7.1/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.1/cli/conf.d/20-phar.ini
- /etc/php/7.1/cli/conf.d/20-posix.ini
- /etc/php/7.1/cli/conf.d/20-readline.ini
- /etc/php/7.1/cli/conf.d/20-shmop.ini
- /etc/php/7.1/cli/conf.d/20-sockets.ini
- /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.1/cli/conf.d/20-sysvsem.ini
- /etc/php/7.1/cli/conf.d/20-sysvshm.ini
- /etc/php/7.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
Installation failed, deleting ./composer.json.
I'm using the latest composer version...
php7 , mysql , apache2 already installed
Just need zip extension:
# For php v7.2
sudo apt-get install php7.2-zip
it says the requested PHP extension zip is missing from your system.
you have to enable or install that.
# For php v7.0
sudo apt-get install php7.0-zip
# For php v7.1
sudo apt-get install php7.1-zip
I worked by previously installing Composer, after php.
Run:
sudo apt-get install php7.2-zip
sudo apt-get install php7.2-curl
The only thing that helped me was updating my PHP to 7.4 with Brew.
brew install php#7.4
Nothing else worked for me.
if you use php 7.3
sudo apt-get install php7.3-curl
or simply if you are not sure with the version, just use code below
sudo apt-get install php7.2-curl
The only thing that helped me was install php-xml
sudo apt-get install php-xml

Resources