Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未加载WebPush gmp扩展,但需要它来发送带负载的推送通知。您可以在php.ini中修复此问题_Php_Laravel_Push Notification_Notifications_Web Push - Fatal编程技术网

未加载WebPush gmp扩展,但需要它来发送带负载的推送通知。您可以在php.ini中修复此问题

未加载WebPush gmp扩展,但需要它来发送带负载的推送通知。您可以在php.ini中修复此问题,php,laravel,push-notification,notifications,web-push,Php,Laravel,Push Notification,Notifications,Web Push,我正在使用webpush处理通知。我使用link来实现通知推送。我正在搜索和应用上周的每一个解决方案,但同样的问题 我安装了gmp,并在xampp/etc/php.ini中添加了它 extension = mcrypt.so 这是我的密码 class InvoicePaid extends Notification implements ShouldQueue { use Queueable; public $title, $body; public function

我正在使用webpush处理通知。我使用link来实现通知推送。我正在搜索和应用上周的每一个解决方案,但同样的问题 我安装了gmp,并在xampp/etc/php.ini中添加了它

extension = mcrypt.so
这是我的密码

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');
    }
}
我的路线是

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
    ]);
});
但是当我发送通知时,我得到了这个错误


这是gmp安装的图片

请尝试转到您的
xampp/php/ext
文件夹

  • 检查
    php\u gmp.dll
    是否存在

    • 打开
      xampp/php/php.ini

      搜索
      php_gmp
      ,确保它像
      extension=php_gmp.dll
      而不是
      ;extension=php\u gmp.dll

  • 否则

    • 请将
      php\u gmp.dll
      下载到该文件夹,然后重试该过程

你不应该再有gmp问题了。

Ubuntu18.04,PHP7.4。通过以下命令解决:

  • sudo apt安装php7.4-gmp
  • sudo服务php7.4-fpm重启

  • 您使用的是哪个版本的PHP?请确保安装了PHP gmp并将这一行添加到PHP.ini中:
    extension=PHP\u gmp。因此
    我安装了PHP gmp并在PHP.ini中添加了这一行。请告诉我如何确保安装了gmp?重新启动服务器。然后在服务器根目录中创建一个名为
    index.php
    whateveryouwant.php
    的文件。将此代码粘贴到该文件中:
    。然后导航到
    http://localhost/index.php
    http://localhost/whateveryouwant.php
    在浏览器中检查php配置设置。如果您在那里找到
    gmp
    ,则它已安装。GNU gmp支持Stanislav Malyshev这是我在调用phpinfo()f后获得的有关gmp的信息