Search code examples
phpandroidsslapple-push-notificationssl4a

Execute Apple Push Notification Server (PHP) from Android Device using "PHP for Android"


I recently downloaded and installed "PHP for Android." I created a .php file that utilizes an SSL connection with port 2195. I followed a guide for writing a php server that sends push notifications to Apple's APNS, and SUCCESSfully ran it on my Mac. When I put both the .php and the .pem onto my Android phone in the same folder and tried to run it with the same WIFI connection, I get the following error message:

Error:14094410:SSL routines:func(148):reason(1040) in /mnt/sdcard/sl4a/scripts/lot.php on line 19

Warning: stream_socket_client(): Failed to enable crypto in /mnt/sdcard/sl4a/scripts/lot.php on line 19

Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /mnt/sdcard/sl4a/scripts/lot.php on line 19

Does anyone have any ideas of how I can fix this? THANKS!


Solution

  • I had the SSL error on my Windows desktop, with a PHP script that accessed a HTTPS resource.

    The solution was to enable the openssl extension. So maybe it's the same kind of problem you have here, something related to opensll on Php for Android.