2011年2月4日 星期五

Push Notification - sever記

iPhone上高有個功能叫 Push Notification,可以simulate短信形式發放通知。有d apps, 例如 What's App... TextMe 都會用佢simulate短信收發。

當中涉及起一個web server, 同可選擇使用Open-source的 APNS-PHP:

http://code.google.com/p/apns-php/

但佢要gei config都幾special,特別係pcntl這個extension! 
我使用Ubuntu 10.04,但default的PHP setting係冇install到這extension. 所以,只好下載PHP5的source,再make過:

mkdir php
cd php
apt-get source php5
cd php5-(WHATEVER_RELEASE)/ext/pcntl
phpize
./configure
make

注意的是"phpize"係要install的:

apt-get install php5-dev

然後再copy個pcntl.so到/usr/lib/php5/(extension_folder)/入面。

同埋,個pcntl.ini要加到/etc/php5/apache2/conf.d/內。

pcntl.ini有:
extension=pcntl.so

最後就係restart Apache2:

/etc/init.d/apache2 restart

行一行phpinfo, 會見到:

pcntl support enabled



沒有留言:

張貼留言