{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/hhvm/issues/2154","repository_url":"https://api.github.com/repos/facebook/hhvm","labels_url":"https://api.github.com/repos/facebook/hhvm/issues/2154/labels{/name}","comments_url":"https://api.github.com/repos/facebook/hhvm/issues/2154/comments","events_url":"https://api.github.com/repos/facebook/hhvm/issues/2154/events","html_url":"https://github.com/facebook/hhvm/issues/2154","id":29979185,"number":2154,"title":"stream_socket_client() raises OpenSSL error (works fine in PHP)","user":{"login":"marcoarment","id":366193,"avatar_url":"https://avatars.githubusercontent.com/u/366193?v=3","gravatar_id":"","url":"https://api.github.com/users/marcoarment","html_url":"https://github.com/marcoarment","followers_url":"https://api.github.com/users/marcoarment/followers","following_url":"https://api.github.com/users/marcoarment/following{/other_user}","gists_url":"https://api.github.com/users/marcoarment/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoarment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoarment/subscriptions","organizations_url":"https://api.github.com/users/marcoarment/orgs","repos_url":"https://api.github.com/users/marcoarment/repos","events_url":"https://api.github.com/users/marcoarment/events{/privacy}","received_events_url":"https://api.github.com/users/marcoarment/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/hhvm/labels/duplicate","name":"duplicate","color":"000000"},{"url":"https://api.github.com/repos/facebook/hhvm/labels/mid-pri","name":"mid-pri","color":"fad8c7"},{"url":"https://api.github.com/repos/facebook/hhvm/labels/php5%20incompatibility","name":"php5 incompatibility","color":"837ced"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2014-03-23T03:55:38Z","updated_at":"2016-03-24T07:18:26Z","closed_at":"2014-10-08T09:25:11Z","body":"As part of my Apple Push Notification (APN) class, I open an SSL connection with `stream_socket_client`:\r\n\r\n```php\r\n$ctx = stream_context_create();\r\nstream_context_set_option($ctx, 'ssl', 'local_cert', $cert_filename);\r\nstream_context_set_option($ctx, 'ssl', 'passphrase', $cert_password);\r\n\r\n$connection = stream_socket_client(\r\n    'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60,\r\n    STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx\r\n);\r\n```\r\n(abridged; [file's full source](https://gist.github.com/marcoarment/9718357#file-applepushnotification-php-L110))\r\n\r\nThis is called from a CLI script. With PHP 5.4.26, it works fine every time, on the same server, in the same directory, with the same data, immediately before or after trying it in HHVM. I think this safely rules out certificate or connection issues.\r\n\r\nWhen run under HHVM, this happens every time:\r\n\r\n```\r\nSSL operation failed with code 1. OpenSSL Error messages:\r\nerror:14094410:SSL routines:func(148):reason(1040)\r\n\r\n#0 (): reprise_error_handler()\r\n#1 /.../ApplePushNotification.php(107): stream_socket_client()\r\n#2 /.../ApplePushNotification.php(69): ApplePushNotification::connection()\r\n#3 /.../APNS.php(44): ApplePushNotification::send_to_device()\r\n...\r\n```\r\n\r\nHHVM info:\r\n\r\n```\r\n$ hhvm --version\r\nHipHop VM 2.4.0 (rel)\r\nCompiler: tags/HHVM-2.4.0-0-gc82fcd8e6199c500454b1a8b930a876ef2c1522b\r\nRepo schema: c63b08a9dc618c8a3eaea633d4d1776b668c75d6\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/hhvm/issues/comments/200702217","html_url":"https://github.com/facebook/hhvm/issues/2154#issuecomment-200702217","issue_url":"https://api.github.com/repos/facebook/hhvm/issues/2154","id":200702217,"user":{"login":"aquasmit","id":924596,"avatar_url":"https://avatars.githubusercontent.com/u/924596?v=3","gravatar_id":"","url":"https://api.github.com/users/aquasmit","html_url":"https://github.com/aquasmit","followers_url":"https://api.github.com/users/aquasmit/followers","following_url":"https://api.github.com/users/aquasmit/following{/other_user}","gists_url":"https://api.github.com/users/aquasmit/gists{/gist_id}","starred_url":"https://api.github.com/users/aquasmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aquasmit/subscriptions","organizations_url":"https://api.github.com/users/aquasmit/orgs","repos_url":"https://api.github.com/users/aquasmit/repos","events_url":"https://api.github.com/users/aquasmit/events{/privacy}","received_events_url":"https://api.github.com/users/aquasmit/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T07:18:26Z","updated_at":"2016-03-24T07:18:26Z","body":"@integrii How you got it working. I am getting same error. I am using hhvm 3.12 but still i m getting same error \"Unable to enable crypto on TCP connection gcm-http.googleapis.com\""}}