Installing GMP on docker using lando

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x