php 无法连接到“ssl://gateway.sandbox.push.apple.com:2195”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16059976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:27:43  来源:igfitidea点击:

Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195'

phpapacheopensslapple-push-notifications

提问by Rico Chan

I sucessfully run the APNS code in my macbook air, but it turns out that I can not run it in my other computer:

我在我的 macbook air 中成功运行了 APNS 代码,但结果我无法在我的另一台计算机上运行它:

I checked that these are the same: 1. .pem file ( to be specific ) 2. Program

我检查了这些是否相同: 1. .pem 文件(具体而言) 2. 程序

The computers can not work are:

不能工作的电脑是:

Windows 7,XAMPP,OpenSSL supported,No firewall

Windows 7,XAMPP,支持OpenSSL,无防火墙

And

EC2 Linux server with 2195 and 2196 opened

已打开 2195 和 2196 的 EC2 Linux 服务器

What might be other issues causing that I got this error in my php code?

可能是什么其他问题导致我在我的 php 代码中出现此错误?

Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195'

I know there might be cause by not opening SSL, but I checked the phpInfo(), it should be correct.

我知道可能是没有打开 SSL 的原因,但我检查了 phpInfo(),它应该是正确的。

openssl 

OpenSSL support enabled 
OpenSSL Library Version OpenSSL 1.0.1c 10 May 2012 
OpenSSL Header Version  OpenSSL 0.9.8x

I tried telnet in EC2 server, it gives:

我在 EC2 服务器上尝试了 telnet,它给出了:

telnet gateway.push.apple.com 2195
Trying 17.149.36.239...
Connected to gateway.push-apple.com.akadns.net.
Escape character is '^]'.

采纳答案by Rico Chan

Thanks for help, so far I solved the solution.

感谢您的帮助,到目前为止我解决了解决方案。

The problem is that I used the same pem file for both my cert and the root cert.

问题是我对我的证书和根证书使用了相同的 pem 文件。

There is a root cert that is different from my own cert, during connection, both cert is used so I have to get the root cert of apple push notification.

有一个根证书与我自己的证书不同,在连接过程中,两个证书都被使用,所以我必须获得苹果推送通知的根证书。

Thanks!

谢谢!

回答by mavericks

In case of MAC, (built-in server was working fine using terminal but not through browser, for me, so i installed MAMP.)

MAC 的情况下,(对我来说,内置服务器使用终端运行良好,但不能通过浏览器运行,所以我安装了 MAMP。)

1.Go to---> /Library/WebServer/Documents/----copy both phpand ckdev.pemfile here.

1.转到---> /Library/WebServer/Documents/----复制phpckdev。pem文件在这里。

2 go to terminal-->$open /private/etc-->go to--->apache2>originals>httpd.config file--> **"#LoadModule php5_module libexec/apache2/libphp5.so", remove "#"..(perhaps, you would have to change the permission also..!)

2 去终端--> $open /private/etc-->去-->apache2>originals>httpd.config 文件--> **"#LoadModule php5_module libexec/apache2/libphp5.so",去掉" #"..(也许,你也必须更改权限..!)

then goto browser and check--> localhost/yourPhpFile.php

然后转到浏览器并检查--> localhost/yourPhpFile.php

In Case of Windows system,

Windows 系统的情况下

1.Install WAMP,

1.安装WAMP

2.goto php.inifile--->search for this ";extension=php_openssl.dll" line and remove semicolon ";".

2.转到php.ini文件--->搜索“ ;extension=php_openssl.dll”这一行,去掉分号“ ;”。

3.click WAMP icon from right-bottom goto PHP>PHP Extensions>select php_openssl..

3.单击右下角的WAMP图标转到PHP>PHP扩展>选择php_openssl..

That's it..hope this may help further seekers.

就是这样..希望这可以帮助进一步的寻求者。

回答by Deepu

  1. if you are getting an error like this "Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?" then follow the next step

  2. if php has not got ssl enabled then goto php.ini and change this to ";extension=php_openssl.dll" "extension=php_openssl.dll" (remove the semicolon) and save it and run the program.

  1. 如果您收到这样的错误“无法找到套接字传输“ssl” – 您在配置 PHP 时是否忘记启用它?然后按照下一步

  2. 如果 php 没有启用 ssl,则转到 php.ini 并将其更改为“;extension=php_openssl.dll”“extension=php_openssl.dll”(删除分号)并保存并运行程序。