• 12

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

How to install GMP for PHP7 on Ubuntu

I was getting the following error when trying to run composer update on a SimpleSAML project.

- openid/php-openid dev-master requires ext-gmp * -> the requested PHP extension gmp is missing from your system.

Running sudo apt-get install php5-gmp did not work and neither did sudo apt-get install php7-gmp

    • What does "did not work" mean? Did apt-get report an error (php7-gmp doesn't exist) or did it install fine but not help (php5-gmp is not used by php7)? The command apt search php gmp gives you the list of relevant packages, it suggests that you should install php-gmp if you are using whatever the current default version of PHP is, or php7.0-gmp if you very specifically want to use PHP version 7.0.
      • 2
    • Yes. The error was that the package did not exist. Oh apt search php gmp would have been a great thing to do.

To install GMP for PHP7.0 on Ubuntu, run: sudo apt-get install php7.0-gmp

Make sure your php.ini contains the following: extension=php_gmp.so

To find out where your php.ini is located, run: php --ini

  • 58
Reply Report

If you are running php 7.2 and above, then

sudo apt-get install php7.2-gmp

or you can as well install bcmath extension using

sudo apt-get install php7.2-bcmath

I recommend you install both of them, after complete install restart apache

sudo service apache2 reload

sudo service apache2 restart

  • 3
Reply Report

It's better to search using package or dependency manager installed in machine. For yum, you can search using yum search gmp and then install.

yum search gmp

This will yield these search results

Loaded pluginss: extras_suggestions, langpacks, priorities, update-motd
170 packages excluded due to repository priority protections
========================================================= N/S matched: gmp ==========================================================
perl-Math-BigInt-GMP.x86_64 : Math::BigInt::GMP Perl module
python-gmpy2.x86_64 : Python 2 interface to GMP, MPFR, and MPC
gmp.x86_64 : A GNU arbitrary precision library
gmp.i686 : A GNU arbitrary precision library
gmp-devel.x86_64 : Development tools for the GNU MP arbitrary precision library
gmp-static.x86_64 : Development tools for the GNU MP arbitrary precision library
mingw32-gmp.noarch : Cross-compiled GNU arbitrary precision library
mingw64-gmp.noarch : Cross-compiled GNU arbitrary precision library
perl-Math-GMP.x86_64 : High speed arbitrary size integer math
php-gmp.x86_64 : A module for PHP applications for using the GNU MP library

Now install extension with: yum install php-gmp.x86_64

  • 1
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions