Closed schofs closed 1 year ago
@schofs Could you please check that your php is compiled against Curl 7.46+ ? You can have correct version of curl in your system but it can be wrong version in php
When running phpinfo() from the server, this is what I get back
PHP-CLI and PHP-FPM can have different compiled versions of curl. Did you check this also?
When running the following from the command line:
php -r "phpinfo();"
I get:
phpinfo()
PHP Version => 7.4.9
System => Linux ... 5.8.0-33-generic #36-Ubuntu SMP Wed Dec 9 09:14:40 UTC 2020 x86_64
Build Date => Oct 26 2020 15:17:14
Server API => Command Line Interface
....
....
curl
cURL support => enabled
cURL Information => 7.68.0
Age => 5
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => Yes
HTTPS_PROXY => Yes
MULTI_SSL => No
BROTLI => Yes
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => x86_64-pc-linux-gnu
SSL Version => OpenSSL/1.1.1i
ZLib Version => 1.2.11
libSSH Version => libssh/0.9.3/openssl/zlib
Directive => Local Value => Master Value
curl.cainfo => no value => no value
Is the curl.cainfo => no value => no value
likely to be an issue? (same for FPM too)
Now I have no idea what can be wrong
If there's no errors coming back, does that suggest the curl is failing? I've tested that curl itself is working, so it's not that curl itself can't be called, but I'm wondering why there are no actual errors coming back.
OK - I've worked out the issue. Having gone through the code and looked at where the failure is, it's that the Curl requests to https sites are failing. So I added the following to prepareHandle(Notification $notification)
in Client.php
:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
And it's working now!
Seems it is the same problem which was fixed in PR #110 yesterday You can add curl options for Client in version 0.12.1
@schofs I'm facing the same issue as you, but due to security reasons, we could not disable CURLOPT_SSL_VERIFYPEER by adding the above option. Any suggestion @edamov?
I also have tried to download cacert.pem file from https://curl.se/docs/caextract.html
and then add the option as:
curl_setopt($ch, CURLOPT_CAINFO, "cacert.pem");
but it still not work
@dinhdanh you can use this approach we have discussed today.
I think @andrew-bibby has uncovered the actual bug in Linux that's caused this, their comment on the related issue on a Laravel implementation of this library includes more information and a solution for the time being.
Have been setting up a new server, which I believe meets the spec. I've got a live app at the moment using the old APNS setup, so I know the apple side of things is set up correctly, and I'm using a device token ID that I know is valid because it's the one I successfully use to send push notifications to using the old system.
Ubuntu 20.10 Apache 2.4.46
HTTP2
lib-curl > 7.46
PHP >7.2
Open SSL >1.0.2e
Execution file I run to send the push (using https:// url)
This is the output I get:
What am I missing? It's the empty responses that make me think something in the system setup is wrong and no valid data is coming back.