Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebPush gmp extension is not loaded but is required for sending push notifications with payload . You can fix this in your php.ini

I am working on notification using webpush. i used this link to implement notificaton web push.I am searching and applying every solution from last week but same problem I installed gmp and i added in xampp/etc/php.ini

extension = mcrypt.so

This is my code

class InvoicePaid extends Notification implements ShouldQueue
{
    use Queueable;
    public $title, $body;
    public function __construct($title, $body)
    {
        //
        $this->title = $title;
        $this->body = $body;
    }
    public function via($notifiable)
    {
        return [WebPushChannel::class];
    }

    public function toWebPush($notifiable, $notification)
    {
        $time = \Carbon\Carbon::now();
        return WebPushMessage::create()
            // ->id($notification->id)
            ->title($this->title)
            ->icon(url('/push.png'))
            ->body($this->body);
        //->action('View account', 'view_account');
    }
}

My route is

Route::post('/send-notification/{id}', function($id, Request $request){
    $user = \App\User::findOrFail($id);
    $user->notify(new \App\Notifications\GenericNotification($request->title, $request->body));
    return response()->json([
        'success' => true
    ]);
});

But when i send notification i got this error enter image description here

This is picture of gmp installation

like image 294
Mudassir Avatar asked Nov 11 '17 05:11

Mudassir


2 Answers

Ubuntu 18.04, PHP 7.4. Solved by following commands:

  1. sudo apt install php7.4-gmp
  2. sudo service php7.4-fpm restart
like image 152
Rus Skazkin Avatar answered Nov 20 '22 15:11

Rus Skazkin


Try to go to your xampp/php/ext folder

  • check if php_gmp.dll exists

    • open xampp/php/php.ini

      search for php_gmp and make sure it's like extension=php_gmp.dll instead of ;extension=php_gmp.dll

  • else

    • download php_gmp.dll to the folder and try the procedure again

You should not have gmp issue again.

like image 2
myckhel Avatar answered Nov 20 '22 16:11

myckhel