php-ip icon indicating copy to clipboard operation
php-ip copied to clipboard

GMP error on IPBlock run

Open CasualCarlos opened this issue 2 years ago • 2 comments

Hi, today I installed the rlanvin/php-ip package via composer. Alongside that I also added the 'ext-gmp' to my composer.json:

"require": {
        "php": "^8.1",
        "ext-gmp": "*",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.18",
        "laravel/tinker": "^2.7",
        "league/flysystem-aws-s3-v3": "^3.0",
        "rlanvin/php-ip": "^3.0",
        "s1lentium/iptools": "^1.1",
        "spatie/laravel-ignition": "^1.3",
        "spatie/laravel-json-api-paginate": "^1.12"
    },

I added a call to the IPBlock like this: $block = IPBlock::create($subnet->network.'/'.$subnetPrefix); but upon running I get this error message:

{
    "message": "Call to undefined function PhpIP\\gmp_init()",
    "exception": "Error",
    "file": "/var/www/html/vendor/rlanvin/php-ip/src/IP.php",
    "line": 196,
    "trace": [
        {
            "file": "/var/www/html/vendor/rlanvin/php-ip/src/IP.php",
            "line": 145,
            "function": "initGmpFromString",
            "class": "PhpIP\\IP",
            "type": "::"
        },

Is there anyone who knows what I've done wrong, or if this is just a bug in the package?

CasualCarlos avatar Nov 09 '22 09:11 CasualCarlos