Sending iOS notification through a php script: 'Unable to set private key file'

后端 未结 7 1642
囚心锁ツ
囚心锁ツ 2021-01-06 00:49

I have used the php script from the well known Ray Wanderlich tutorial to send push notifications during development phase. They were triggered properly after I created the

7条回答
  •  日久生厌
    2021-01-06 01:01

    If the file ck.pem does exist in that location it may be that the php script does not have access to it. I would change the permissions of the folder/files to something more lenient or try running the script as the superuser:

    sudo php simplepush.php
    

    Edit 1:

    After some research it looks like the pem file could be in an unexpected format. You could try changing the order of the certificates that were combined in the file. You can also try using separate files and specifying each file using the 'stream_context_set_option' functions.

    Edit 2:

    If you can, try to set up the passwords for your production files the same way as the tutorial. It's possible the passphrase is required for it to work. Again, sounds like something is wrong with the pem file, either generated incorrectly, missing, or in the wrong format. Check the file. Maybe even post it up in your question if it is not a security risk. You can probably just regenerate a new key after figuring out what is wrong.

提交回复
热议问题