Shindig を動かしてみる(PHP 版 Gadget Server)
Shindig を動かしてみるその2。久しぶりにレポジトリ見ると PHP 版の Gadget Server ができているようなので README 見ながら試してみます。
環境は前回と同じで、coLinux、Linux debian 2.6.17-co-0.8.0 #1 PREEMPT Sun Jul 8 14:00:12 CEST 2007 i686 GNU/Linux です。
[maihara@debian:~/work] $ svn co http://svn.apache.org/repos/asf/incubator/shindig/trunk shindig
[maihara@debian:~/work] $ shindig/php/gadgets
[maihara@debian:~/work/shindig/php/gadgets] $ l
合計 16
-rw-r--r-- 1 maihara maihara 893 2008-04-23 10:59 README
-rw-r--r-- 1 maihara maihara 2294 2008-04-23 10:59 config.php
-rw-r--r-- 1 maihara maihara 2548 2008-04-23 10:59 index.php
drwxr-xr-x 4 maihara maihara 4096 2008-04-23 10:59 src/
[maihara@debian:~/work/shindig/php/gadgets] $ v README
Installing and Running The PHP Shindig Gadget Server
============================================
1) Make sure you have PHP 5.x installed and have the simplexml and json extentions enabled; It also
requires apache with .htaccess and mod_rewrite support
2) Copy the files to your web root, and edit the config.php web_prefix and debug settings
to your liking. Make sure that the features and javascript directories are also copied
or edit your config.php to reflect their location.
3) Hit server at http:///gadgets/ifr?url=
Example: http:///gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml
Or hit the sample container at http:///gadgets/files/samplecontainer/samplecontainer.html
The PHP source of the gadget server resides in gadgets/src.
For more information, see http://incubator.apache.org/projects/shindig.html
というわけで、まずは必要なファイルをコピー。
[maihara@debian:~/work/shindig/php/gadgets] $ cp -R ../gadgets ~/public_html
[maihara@debian:~/work/shindig/php/gadgets] $ cp -R .htaccess ../../config ../../features ../../javascript ~/public_html/gadgets
[maihara@debian:~/work/shindig/php/gadgets] $ ~/public_html/gadgets
設定を編集、の前に mod_rewrite を有効に。
[maihara@debian:~/public_html/gadgets] $ /etc/apache2/mods-enabled
[maihara@debian:/etc/apache2/mods-enabled] $ sudo ln -s ../mods-available/rewrite.load
[maihara@debian:/etc/apache2/mods-enabled] $ /etc/apache2/sites-available
[maihara@debian:/etc/apache2/sites-available] $ sudo cp default default.bak
[maihara@debian:/etc/apache2/sites-available] $ diff -u default.bak default
--- default.bak 2008-04-23 12:12:26.000000000 +0900
+++ default 2008-04-23 12:39:42.000000000 +0900
@@ -38,6 +38,10 @@
UserDir public_html
+
+ AllowOverride All
+
+
Alias /doc/ “/usr/share/doc/”
Options Indexes MultiViews FollowSymLinks
[maihara@debian:/etc/apache2/sites-available] $ sudo /etc/init.d/apache2 restart
設定を編集。
[maihara@debian:/etc/apache2/mods-enabled] $ ~/public_html/gadgets
[maihara@debian:~/public_html/gadgets] $ cp config.php config.php.bak
[maihara@debian:~/public_html/gadgets] $ vi config.php
[maihara@debian:~/public_html/gadgets] $ diff -u config.php.bak config.php
--- config.php.bak 2008-04-23 11:26:01.000000000 +0900
+++ config.php 2008-04-23 12:20:28.000000000 +0900
@@ -9,15 +9,15 @@
// The base prefix under which the gadget url's live, if its the root set this to ''
// don't forget to update your .htaccess to reflect this, as well as your container
// javascript like: gadget.setServerBase('/gadgets/');
- 'web_prefix' => '/gadgets',
+ 'web_prefix' => '/~maihara/gadgets',
// location of the features directory on disk. The default setting assumes you did a
// full checkout of the shindig project, and not just the php part.
// Otherwise also checkout the features, config and javascript directories and set
// these to their locations
- 'features_path' => realpath(dirname(__FILE__)).'/../../features/',
- 'container_path' => realpath(dirname(__FILE__)).'/../../config/',
- 'javascript_path' => realpath(dirname(__FILE__)).'/../../javascript/',
+ 'features_path' => realpath(dirname(__FILE__)).'/features/',
+ 'container_path' => realpath(dirname(__FILE__)).'/config/',
+ 'javascript_path' => realpath(dirname(__FILE__)).'/javascript/',
// If you want to use the yuicompressor (http://developer.yahoo.com/yui/compressor/) to minify your javascript
// set this to the yuicompressor-?.jar's file path
[maihara@debian:~/public_html/gadgets] $ diff -u .htaccess.bak .htaccess
--- .htaccess.bak 2008-04-23 12:41:43.000000000 +0900
+++ .htaccess 2008-04-23 12:20:50.000000000 +0900
@@ -3,5 +3,5 @@
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule . /gadgets/index.php [L]
+RewriteRule . /~maihara/gadgets/index.php [L]
んな感じっすか。
で、http://localhost:8080/~maihara/gadgets/files/samplecontainer/samplecontainer.html にアクセスすると以下のような画面が。
curl_init() が失敗しているので php5-curl をインストール。
[maihara@debian:~/public_html/gadgets] $ sudo aptitude install php5-curl
[maihara@debian:~/public_html/gadgets] $ sudo /etc/init.d/apache2 restart
で、そのエラーは出なくなったけど今後は Failed to retrieve gadget content ってエラーが出ております。
見るページを変えます。README にあるように http://localhost:8080/~maihara/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml にアクセス。と、これはこれで Unsupported feature(s): locked-domain つってエラーだ YO!
面倒なってきましたが、ソース src/GadgetServer.php の 163 行目あたりを見てみると http://www.labpixies.com/campaigns/todo/todo.xml にある locked-domain がサポートされていない機能だっつって怒られているようなので、もうちょっと調べないとだけど時間切れ。
というか仕組みをもっと調べないと。
[2008/04/28 追記]
locked-domain はこれ。ユーザのセンシティブなデータを保存するときはこの機能を使えとのことだけど、実際の動作がどう変わるのかはまだわからない。
About this entry
You’re currently reading “ Shindig を動かしてみる(PHP 版 Gadget Server) ,” an entry on forever 5 years old blog
- Published:
- 1pm on 2008/04/23
- Category:
- OpenSocial, プログラミング
- Related Posts:


No comments
Jump to comment form | comments rss [?] | trackback uri [?]