This is the right process to generate the PRODUCTION certificate?
openssl x509 -in aps_development.cer -inform der -out myCert.pem
openssl pkcs12 -nocerts -out myKey.pem -in myCert.p12
cat myCert.pem myKey.pem > my.pem
.. and then:
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'certificati/my.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
// Open a connection to the APNS server
$fp = stream_socket_client(
'ssl://gateway.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
Yes, it all looks fine to me.
You can check your production commands against the following good tutorial:
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
And your PHP code to connect to the live APNS server appears equally valid. You can compare it against a few good answers here:
https://stackoverflow.com/a/8249772/766441
https://stackoverflow.com/a/9536457/766441
You may also consider switching the server address to the sandbox APNS server, testing all of your code and then switching the URL to the live server when you are ready to submit the app.
Hope this helps.