Luracast Restler不在Google App Launcher上工作

时间:2014-09-12 03:22:08

标签: php google-app-engine restler

我想在子云上创建一个基于Google Cloud(基于Google App Engine GAE的Joomla和Restler RESTful API服务器)的网站:

http:// api.restlerongooglecloud .com for hybrid app(基于Restler API,提供Android,iOS,Windows Phone等智能手机)

博客:http:// joomla.restlerongooglecloud .com(GAE Launcher上的Joomla博客工作得很好,我在这个链接上跟着指南:http:// forum.joomla .org / viewtopic.php?f = 706& t = 828565& p = 3114492)

http:// www.restlerongooglecloud .com主页。

在我将实时网站上传到GAE Cloud之前,我尝试测试Restler是否可以正常使用Google App Launcher。

目录结构是

GAEproject-root / api / ... for Restler 3.0 RC3

GAEproject-root / joomla / for blog

GAEproject-root / app.yaml

我的app.yaml如下:

application: restlerongae
version: 1

runtime: php

api_version: 1



handlers:
## api images
- url: /api/(.*\.(ico$|jpg$|png$|gif$))
  static_files: api/\1
  upload: api/(.*\.(ico$|jpg$|png$|gif$))
  application_readable: true

## api html
- url: /api/(.*\.(htm$|html$|css$|js$))
  static_files: api/\1
  upload: api/(.*\.(htm$|html$|css$|js$))
  application_readable: true

## api test1
- url: /api/(.*)
  script: api/public/examples/_001_helloworld/index.php

当我运行网站并指向Restler 3.0 RC5示例时:

http:// localhost / api / public / examples / _001_helloworld / say / hello 我收到以下错误:

{ "error": { "code": 404, "message": "Not Found" }, "debug": { "source": "Routes.php:359 at route         stage", "stages": { "success": [ "get" ], "failure": [ "route", "negotiate", "message" ] } } }

我试图弄清楚为什么会出现这个错误,但遗憾的是我并不是面向对象的PHP和Restler的新手。

请帮助,我该如何解决此错误。

由于GAE不使用" .htaccess"文件或Apache,如何建模" Aapache mod_rewrite功能"使用" mod_rewrite.php"请在此处查看更多详细信息:https:// developers.google .com / appengine / docs / php / config / mod_rewrite

此外:

由于应用程序的分布式特性,App Engine不支持写入本地文件。相反,必须保留的数据应存储在分布式数据存储中。有关更多信息,请参阅运行时沙箱上的文档

App Engine应用程序不能:

写入文件系统。应用程序必须使用App Engine数据存储区来存储持久数据。允许从文件系统读取,并且随应用程序上传的所有应用程序文件都可用。

直接打开套接字或访问其他主机。应用程序可以使用App Engine URL提取服务分别向端口80和443上的其他主机发出HTTP和HTTPS请求。

生成子流程或线程。必须在几秒钟内在单个进程中处理对应用程序的Web请求。终止需要很长时间才能响应的进程,以避免Web服务器过载。

进行其他类型的系统调用。

GAE为Google云端存储提供了一个流包装器,使得使用该服务变得非常简单。假设您已经完成了GCS的先决条件文件,可以使用标准的PHP文件处理函数来访问它们,如文档中所示。     

$contents = file_get_contents($file);
var_dump($contents); // prints: hello world
?>

我认为HumanReadableCache.php中的代码需要更改为使用gs:// bucket / file进行缓存实现。 (apiVersionMap自动生成的文件)我不是一个OOP_PHP程序员来替换/编辑HumanReadableCache.php中的代码所以你能帮忙并提出一个GAE版本的Restler吗?非常感谢。

1 个答案:

答案 0 :(得分:0)

您是否可以尝试使用已修改版本的HumanReadableCache且不检查文件可写性的RC6

index.php中的

执行以下操作以映射数据gs路径的保存

use Luracast\Restler\Restler;
use Luracast\Restler\HumanReadableCache;

HumanReadableCache::$cacheDir = 'gs://bucket'; //replace bucket with your bucket name

$r = new Restler();
//...