在实时服务器上以分发模式运行php脚本的apns [英] apns running php script in distribution mode on live server

查看:120
本文介绍了在实时服务器上以分发模式运行php脚本的apns的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究并实施了这些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

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

我在本地服务器上实现了apns,现在我想在实时服务器上实现它,我的问题是脚本push.php,我们在本地服务器上运行这个

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开发

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

我们如何在生产模式下在实时服务器上运行它,我们是否必须要求域提供商(我们使用Host Gator服务)为我们运行此脚本或者作为光线说

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&
&将从shell中分离脚本并将其放在后台。

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

意味着我们将使用命令行界面在实时服务器上运行该脚本?,i我很困惑,因为在服务器端我们使用cron作业来执行脚本,但这个push.php应该永远不会退出,所以我在这里很困惑,该怎么做。 PLZ。引导我在这里,而不是在advancs。问候Saad

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

推荐答案

是的,应该使用命令行界面来运行PHP脚本并使其在后台运行。

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

但是,由于您使用的是共享托管服务,我怀疑它们会让您持续运行PHP。

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

您可能想尝试询问它们是否可能;如果不是这样,只需编辑您引用的PHP脚本,以便不是在开始时打开连接并继续运行,每次调用它时都会打开与Apple服务器的连接,发送消息,关闭连接并退出。尽管Apple自己并不鼓励这样做,但这只允许在Web服务器需要时调用脚本(这样就不需要连续运行)。

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).

这篇关于在实时服务器上以分发模式运行php脚本的apns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆