2009-11-19 3 views
0

페이로드 데이터를 보내는 동안 PHP 스크립트에서이 오류가 발생합니다.서버 스크립트의 APN 오류

Warning: stream_socket_client() [function.stream-socket-client]: 
Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/test/apn/apns-dev.pem' 
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 

Warning: stream_socket_client() [function.stream-socket-client]: 
failed to create an SSL handle 
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 

Warning: stream_socket_client() [function.stream-socket-client]: 
Failed to enable crypto 
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 

Warning: stream_socket_client() [function.stream-socket-client]: 
unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) 
in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 

왜 그럴까요? 설정을 변경해야합니까? 또한 .pem 파일을 서버에 설치했습니다.

감사

답변

4

당신은 당신이 APN에 연결하는 데 사용하는 PHP 코드 (push.php)를 게시 할 수 있습니까?

어둠 속의 일부 샷 :
- 하나의 .pem 파일에 인증서와 개인 키가 모두 있습니까?
- 비공개 키 파일에서 비밀번호를 삭제 했습니까? 아니면 PHP 코드에서 올바르게 설정 했습니까?
- 스크립트를 실행하는 사용자에게 cert/key 파일을 액세스/읽기 할 수있는 적절한 유닉스 권한이 있습니까?
- 컴퓨터에서 Apple 서버에 액세스 할 수 있습니까? 텔넷을 실행하여 테스트 할 수 있습니다.

telnet gateway.sandbox.push.apple.com 2195 
+0

나는'telnet gateway.sandbox.push.apple.com 2195'을 시도했는데 외국 호스트에 의해 계속 닫혀있다. –

4


나는이 문제를 가지고 있었고, 키 생성 과정이 문제였다 인증서와 내가 모두 동일하게 사용 된 반면, 키 파일에 대한 두 개의 서로 다른하려면 openssl 명령이 있습니다.

openssl pkcs12 -clcerts -nokeys -out aps-dev-cert.pem -in aps-dev-cert.p12 
openssl pkcs12 -nocerts -out aps-dev-key.pem -in aps-dev-key.p12 
openssl rsa -in aps-dev-key.pem -out aps-dev-key.unencrypted.pem 
cat aps-dev-cert.pem aps-dev-key.unencrypted.pem > aps-dev.pem 

주에게 처음 두하려면 openssl 명령의 차이를 : 여기 인증서를 생성하고 (당신이 파일을 .P12 보낸 가정) 개인 키 파일에서 암호를 제거하는 방법입니다.

0

이 문제도 발생했습니다. 나에게 그것은 SSL 옵션에서 '암호'를 명시 적으로 설정을 제거한 후 일 :

$context_options = [ 
    'ssl' => [ 
     'local_cert' => ..., 
     'passphrase' => ..., 
     'ciphers' => 'DES-CBC3-SHA' 
    ] 
]; 
stream_context_set_option($stream_context, $context_options); 

그래서 라인 제거한 후 '암호'=> 'DES-CBC3-SHA'을가했습니다.