Apple Push Certificate doesn't work on specific server - php

I have an iOS app that's beta released since yesterday, but since today the push messages that were send via the Apple production server didn't seem to arrive to the users' phones. I recreated the certificate in the Apple Developer Center, tested it on my local server and verified that the new certificate was working.
Then I deployed the new certificate to my live server, but I keep getting this error message:
stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused)
I've made sure that I really uploaded the new certificate, but even resetting my live server wasn't helping.
I uploaded my project to another live server (a Google Cloud Instance) to verify if the certificate was only working on my local server or if it was just my live server that isn't working properly and the Google live server did deliver the push messages to the devices without an error message.
So it seems my default live server is the only server from where production push messages are not working. The pushes that are sent with the development certificate are delivered from every server successfully by the way.
Why could it be that I can't send push messages from that one specific server? Does anybody have any idea?

You have to check if Push Notification can be send from your server or not. That means the port 2195 should be opened in your server to do the same. Due to technical/ security reasons most of the hosting company blocking the port, you can ask them to open it if they can.
You can confirm whether this is opened or not in your server definitively by using telnet and specifying which port to connect to. From the command line run:
MyServer:~ Home$ telnet gateway.sandbox.push.apple.com 2195
Trying 17.149.34.143...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
If there is an error connecting then it will just hang and not return - the above shows a working example where I can connect.
You'll need an SSH login to your hosting service to test it this way, and unfortunately you are unlikely to be able to test it on shared hosting without buying an account for VPS hosting- so you probably have to rely on asking their customer services.
Note: However shared hosting from Hostgator, dreamhost is working, you can chat with their support team before purchasing.

Related

Filemaker PHP Web Publishing - Synchronising not working with new host address

We have a windows server setup in our premises where we host our FileMaker server (FMS 15).
We are thinking of moving the host into a cloud server (FMS19).
We have taken the latest backup of our databases (from FMS 15) and uploaded it into the cloud server (FMS 19).
The extension of the backup file is .fm12 so it was uploaded easily from FMS15 to FMS 19. Database structure remains exactly the same and the connection from FileMaker pro is also working fine.
The Issue
One of these databases (database db_fm for example) is connected to our website. A cron job runs every 5 minutes on our website that syncs information from the website's database (db_website) to that of FileMaker's databases (db_fm). The sync uses FileMakers “PHP Web Publishing”
After uploading the latest backup in the cloud server (FMS 19) I have changed the host address in the config file
i.e; I have changed the host address from
//host for our internal server
$FileMakerHost = 'http://77.**.***.40:8080';
to
//host for cloud server
$FileMakerHost = 'https://a*****2.fmphost.com/ ;
Database structure and the password for the Filemaker database remained the same. So have not changed anything else other than the host address.
The synchronization works with the current database (hosted in our windows server FMS15) but it is not working with the new host (hosted in cloud server FMS19).
After changing the host address we have created a test subscriber. That record should be added to the FileMaker database (i.e the one hosted in cloud server). But there is no new record created.
Can you please assist me with what can be the issue? I cannot think of anything else other than changing the host address. What can I do to make it work with both servers?
FYI
The sync uses filemakers “PHP Web Publishing” The cloud server
(FMS19) is also in windows and PHP publishing engine is enabled
Our site is built with laravel.
The main problem was the new host address was https. The sync was working for HTTP address not https.
Following are things that we have done to make it work
We added an outbound rule in our webserver (where our website is hosted) on port 443.
Then we have reset the cache via ssh. systemd-resolve --flush-caches
. Because automatic redirect was cached
FMPHOST (The hosting company) suggested us, to test from PHP so that it can get any response from https://a******.fmphost.com/ or http://a******.fmphost.com/ (Use curl commands to prove port is not blocked between the web server and FileMaker Server)
Thank you

what properties should be set for my SMTP

I have setup a Website based on HTML with the exception of a contact.php page. I am hosting this website on my Rasberry Pi 3 computer on Debian flavor of linux Jesse Light. This is headless as it hosts my Portfolio website. I am using Apache2 webserver and installed sendmail as my Mail Transfer Agent (MTA). The problem is I have been spinning my wheels researching for the past week and I am stuck.
My issue is I send email from my php contact page on my live server but nothing ever arrives in my inbox after sending it. I get a mail sent message from my php script after about a minute after sending but then Nothing arrives in the inbox. I am thinking My SMTP on my php.ini is not correct. I put my website domain name FQ name. I am using Microsoft Exchange Online hosted email domain by GoDaddy. Also, anyone have any good advise on what my from / to should be set to on my SMTP configurations?
Sounds like a direct reject to me.
Some hints:
check the SMTP logs from your MS Exchange server (if a connection has been opened and potentially been refused for whatever reason)
check the PHP / Apache logs and see, whether an PHP fatal error or warning occured (mybad bad credentials or wrong port?)
I have had bad experiences with MS Exchange server and SMTP, make sure its proper setup.
check the credentials and settings from an independent client to see if they work flawless.
Hope that helps. Otherwise please provide more details and log samples.
Is your contact.php program hosted on the Godaddy server? If yes- It's not possible to send mail through Godaddy shared hosting servers using your own SMTP settings. You can only send from Godaddy's relay server when using a shared hosting plan. If you wanted to be able to send through your own SMTP servers, you'd need to be hosting with either a VPS or Dedicated Server plan.
Check maillog on your server and you will get the smtp connection timeout errors.
Let me know, in case the problem is something different- will try to address it.

ZK Time and Attendance device with PHP

I am using [ZKlib][1]
[1]: https://github.com/dnaextrim/php_zklib to connect to my ZK time and attendance machine. It is using UDP/SOAP to connect to device. Everything is working fine on localhost. But when I live it on server and try to access it though my public static ip that I have purchased from my ISP, even though I have port forwarded it, it cannot connect to the device. I have no issues in connecting to my IP cam through same router.
Another interesting fact is that if I make 3g Hotspot from my cellphone and connect my laptop to it. Now when I put public static IP of my router from which device is connected, and try to hit the device, Wow! Device is connected. But same application when I live it on server, even though I am on my 3g connection it could not connect to my device though my router that is port forwarded. I am wondering what is the issue with it when I live it.
I resolved it. It was issue with my host server. I had to talk to them to enable php_socket.dll extension on their server. Now it's running fine.

PHP api on linux machine throwing Connection Refused error on accessing

I have hosted website and api on apache server on linux machine. I am trying to access the api through node js (using request module)which is on the same network. From outside that network, the api is accessible and working fine. I have many apis on the machine and only few are throwing this error. Recent change which was made to server is changing the cookie domain from foo.bar.com to *.bar.com in php.ini file. The website is working good. There is not much load on the server too. Any help appreciated.
A "connection refused" error means a TCP connection can't be established, so the cookie domain change should not have an effect here.
Are you sure it's a Node.js "connection refused" error, and not, say, the API itself being able to connect somewhere else? Can you give us the exact error message, with any traceback, etc., context?
You say there are many APIs (assuming API servers) on the machine and only some fail (assuming you tested this from the machine that is having problems connecting to the API server machine).
Are the working servers on different ports compared to the non-working ones?
Do those servers work from within the network? You say they're working fine outside of it. (It's possible that your local network has a firewall policy that prohibits this local connection.)
Can you double-check that the non-working servers are actually running? (An easy way to establish this would be running ss -ltpn; it should give you a list of listening TCP ports and their associated processes.)

Do i really need a Dedicated IP address to send push notifications to APNS

The question has already been asked on this forum but my concern in different. I have shared server space on Crazy domains and Blue Host. I have tried sending push notification with both of them. When i try it on Crazy Domain I get the following error:
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2196 (Connection timed out) in /home4/karmamob/public_html/pushNotification/api.php on line 20
Failed to connect: 110 Connection timed out
When i run the same on Crazy Domain , I get the following error.
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2196 (Connection timed out) in /home4/karmamob/public_html/pushNotification/api.php on line 20
Failed to connect: 110 Connection timed out
There should be no issues with the certificate because it runs fine on my local mac PC.
What i want to ask is, Can I solve this problem if I buy a Dedicated IP from BLUE HOST?
No you don't. Shared hosting plans tend to have controlled environments that you, as a shared user, can't really change, such as open or blocked ports. Is there any way you can check if connections through port 2196 are being successfully established (not necessarily to Apple)? Some low-cost, shared plans are known for blocking some juice in favour of stability and security. Also check if your push certs are properly uploaded. Cheers.
Yes, as NewObjective clarified, 2195 & 2196 ports have to be open. To open these ports you might ask Bluehost technical support team (ticket/chat), but you have to have dedicated IP address before that.
But there is another issue. If you try to send push notification message right after dedicated IP address is set and both ports are open you might receive the same "Connection timed out" error. You can test that problem by logging in to your server via SSH and running "telnet gateway.sandbox.push.apple.com 2195" command. If you receive "Connection timed out" error - you can try to contact Bluehost support team, but they can't solve this problem.
If you try to telnet any other server with 2195 opened port you will also receive that error. I had about 10 chats with Bluehost support team, opened 10 or so tickets, but they really couldn't help me. But two weeks later everything began to work. I think it was because turning dedicated IP on takes some time, but I'm not sure. Anyway, it very interesting that Bluehost support team always answers that the problem is on the Apple side, even if you tell them that any other server with 2195 opened port isn't available too)

Categories