2011-03-13 142 views
2

我試圖在我的服務器上爲工作apns-php(http://code.google.com/p/apns-php/)(專用IP和端口爲2195的Bluehost打開tcp和udp傳出)。推送通知服務器實現

我得到這個錯誤:

Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352 Stack trace: #0 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295): ApnsPHP_Abstract->_connect() #1 /home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41): ApnsPHP_Abstract->connect() #2 {main} thrown in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php on line 352

我有聯繫BlueHost的支持,他們告訴我:

Thanks for contacting us. If seems as though the server ssl://gateway.sandbox.push.apple.com:2195* is refusing to accept the connection made from your account. Is there a way you can whitelist your dedicated ip or accept incoming connections on their end?

有人可以幫我解決了這一點?有任何想法嗎?謝謝!

回答

11

我發現了一個解決方案,我不知道它是否是最好的,但它的工作原理。在Abstract.php(此文件是APNS-php源碼的一部分),我有評論線343現在看起來是這樣的:

$streamContext = stream_context_create(array('ssl' => array(
//'verify_peer' => isset($this->_sRootCertificationAuthorityFile), 
'cafile' => $this->_sRootCertificationAuthorityFile, 
'local_cert' => $this->_sProviderCertificateFile 
))); 

我真的不知道這是什麼線的點,但知道推送通知正常工作。我懷疑它是否能在生產服務器上正常運行。有人知道嗎?

+1

我已經測試過它在我自己的網絡服務器(Windows 7上的WAMP),現在它也可以工作。 – Sebastian 2011-03-13 22:37:01

+0

你也可以查看:https://groups.google.com/forum/#!topic/apns-php/IdzCrxPze7A – Jacksonkr 2013-02-21 17:34:29

+0

這意味着你正在使用Entrust根證書頒發機構禁用驗證同行,請仔細檢查你的根CA您可能會使用相同的文件進行SSL客戶端身份驗證和根CA. – Nish 2014-08-17 16:40:51

0

您可能需要聯繫蘋果..通過它的聲音是什麼樣的是,蘋果訪問其網關阻止烏爾應用..你需要聯繫的蘋果,這樣你可以得到你的IP地址或網絡應用程序批准

0

這個問題正是我在當地發展中看到的。我假設你想在服務器上註銷該行,並且證書都已正確設置。

0

我有同樣的問題,我做錯了什麼是提供SSL客戶端身份驗證和根CA相同的證書,下面的代碼爲我工作

$push = new ApnsPHP_Push(
     ApnsPHP_Abstract::ENVIRONMENT_SANDBOX, 
     'ck.pem' 
    ); 

$push->setRootCertificationAuthority('entrust_root_certification_authority.pem'); 

https://code.google.com/p/apns-php/wiki/CertificateCreation