phplaraveldockerlandophp-gmp

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


Solution

  • 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