apns running php script in distribution mode on live server

╄→尐↘猪︶ㄣ 提交于 2019-12-23 04:33:09

问题


every one i have studied and implemented these tutorials of ray http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2

i have implemented apns on local server, now i want to do it on live server, my question is that the script "push.php", which we are running on local server by using this

/Applications/MAMP/bin/php5.2/bin/php push.php development

how can we run it on live server in production mode, did we have to ask the domain providers (we are using Host Gator Services) to run this script for us or as ray says

"However, on your production server you should start the script as follows:

$ /Applications/MAMP/bin/php5.2/bin/php push.php production & The “&” will detach the script from the shell and put it in the background."

means we will use command line interface to run that script on live server?, i am little confused because on server side we use cron jobs to execute the scripts, but this "push.php" should never exit, so i am confused here, what to do. Plz. guide me in this, thanx in advancs. Regards Saad


回答1:


Yes, the command line interface should be used to run the PHP script and keep it running in the background.

However, as you are on a shared hosting service, I doubt they will let you run PHP continuously.

You may want to try asking them if it is possible; if it is not, just edit the PHP script you cited so that, instead of opening the connection at the beginning and continue running, every time it is invoked it opens a connection to the Apple server, sends the message, closes the connection and exits. Although this is not encouraged by Apple themselves, this would allow your script to be invoked only when it is necessary by the Web server (so that no continuous running is required).



来源:https://stackoverflow.com/questions/9486763/apns-running-php-script-in-distribution-mode-on-live-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!