duanlu5055 2018-06-27 11:47
浏览 39
已采纳

Web Push PHP库错误

I am trying to put push messages on my website with the PHP Push Web library.

Registration when accepting notifications works well. Save and delete if you have accepted or canceled the subscription to notifications.

The error appears when you try to send a message : First I installed GMP, it is well installed, but now it shows a different error with Vendor files.

Catchable fatal error: Argument 2 passed to Mdanter\Ecc\Primitives\CurveParameters::__construct() must be an instance of GMP, resource given
    called in /home/ubuntu/workspace/php_push_demo/vendor/mdanter/ecc/src/Curves/NistCurve.php on line 136 
    and defined in /home/ubuntu/workspace/php_push_demo/vendor/mdanter/ecc/src/Primitives/CurveParameters.php on line 39

Call Stack:
    0.0006     238472   1. {main}() /home/ubuntu/workspace/php_push_demo/send_push_notification.php:0
    0.0118     429552   2. Minishlink\WebPush\WebPush->sendNotification() /home/ubuntu/workspace/php_push_demo/send_push_notification.php:55
    0.0120     435776   3. Minishlink\WebPush\WebPush->flush() /home/ubuntu/workspace/php_push_demo/vendor/minishlink/web-push/src/WebPush.php:115
    0.0120     436896   4. Minishlink\WebPush\WebPush->prepare() /home/ubuntu/workspace/php_push_demo/vendor/minishlink/web-push/src/WebPush.php:156
    0.0122     438872   5. Minishlink\WebPush\VAPID::getVapidHeaders() /home/ubuntu/workspace/php_push_demo/vendor/minishlink/web-push/src/WebPush.php:258
    0.0136     472216   6. Mdanter\Ecc\Curves\NistCurve->generator256() /home/ubuntu/workspace/php_push_demo/vendor/minishlink/web-push/src/VAPID.php:123
    0.0136     472352   7. Mdanter\Ecc\Curves\NistCurve->curve256() /home/ubuntu/workspace/php_push_demo/vendor/mdanter/ecc/src/Curves/NistCurve.php:149
    0.0138     477328   8. Mdanter\Ecc\Primitives\CurveParameters->__construct() /home/ubuntu/workspace/php_push_demo/vendor/mdanter/ecc/src/Curves/NistCurve.php:136
  • 写回答

1条回答 默认 最新

  • dongshi4773 2018-06-28 09:11
    关注

    To fix it I had to update my PHP 7.0 to 7.1 version. After that I haven't had any more problems.

    You can get more information about the library here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素