繁体   English   中英

Luracast Restler无法在Google App启动器上使用

[英]Luracast Restler not working on Google App Launcher

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

http:// api.restlerongooglecloud .com(用于混合应用程序)(基于服务于智能手机(如Android,iOS,Windows Phone)的Restler API)

博客: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上是否工作正常。

目录结构是

用于Restler 3.0 RC3的GAEproject-root / api / ...

GAEproject-root / joomla /用于博客

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,因此如何使用“ mod_rewrite.php”对“ Aapache mod_rewrite功能”进行建模,请在此处查看更多详细信息: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 Cloud Storage提供了一个流包装器,使使用该服务非常简单。 假设您已经完成了GCS上的先决条件文件,可以使用文档中所示的标准PHP文件处理功能进行访问。

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

我认为HumanReadableCache.php中的代码需要更改为使用gs:// bucket / file来实现缓存。 (apiVersionMap AUTO GENERATED FILE)我不是真正的OOP_PHP程序员,要替换/编辑HumanReadableCache.php中的代码,所以请您帮忙并提出GAE版本的Restler吗? 非常感谢。

您是否可以尝试使用RC6,它已修改了HumanReadableCache版本,该版本不检查文件可写性

在index.php中,执行以下操作以映射数据gs路径的保存

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM