简体   繁体   English

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

[英]Luracast Restler not working on Google App Launcher

I want to create a website on Google Cloud (Google App Engine GAE based Joomla and Restler RESTful API Server) with sub domains: 我想在Google Cloud(基于Google App Engine GAE的Joomla和Restler RESTful API服务器)上创建一个具有子域的网站:

http:// api.restlerongooglecloud .com for hybrid app (based on Restler API serving smart phones like Android, iOS, Windows Phone) http:// api.restlerongooglecloud .com(用于混合应用程序)(基于服务于智能手机(如Android,iOS,Windows Phone)的Restler API)

and

blog: http:// joomla.restlerongooglecloud .com (Joomla blog on GAE Launcher is working nicely, I followed the guide at this link: http:// forum.joomla .org/viewtopic.php?f=706&t=828565&p=3114492 ) 博客:http:// joomla.restlerongooglecloud.com(GAE Launcher上的Joomla博客运行良好,我通过此链接关注了该指南:http:// forum.joomla .org / viewtopic.php?f = 706&t = 828565&p = 3114492 )

and

http:// www.restlerongooglecloud .com for main page. 网址为http:// www.restlerongooglecloud.com。

Before I upload live site to GAE Cloud I tried to test if Restler is working fine with Google App Launcher. 在将实时网站上传到GAE Cloud之前,我曾尝试测试Restler在Google App Launcher上是否工作正常。

The directory structure is 目录结构是

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

GAEproject-root /joomla/ for blog GAEproject-root / joomla /用于博客

GAEproject-root / app.yaml GAEproject-root / app.yaml

My app.yaml is as follows: 我的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

When I run the website and point to Restler 3.0 RC5 example: 当我运行网站并指向Restler 3.0 RC5示例时:

http:// localhost /api/public/examples/_001_helloworld/say/hello I get following error: 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" ] } } }

I tried to figure out why this error, but unfortunately I am not successful and new to object oriented PHP and Restler. 我试图弄清楚为什么会出现此错误,但是不幸的是,我并不成功,并且是面向对象的PHP和Restler的新手。

Please help, how do I fix this error. 请帮助,如何解决此错误。

As GAE does not use ".htaccess " file or Apache, how to model "the Aapache mod_rewrite feature" using "mod_rewrite.php" Please see more details here: https:// developers.google .com/appengine/docs/php/config/mod_rewrite 由于GAE不使用“ .htaccess”文件或Apache,因此如何使用“ mod_rewrite.php”对“ Aapache mod_rewrite功能”进行建模,请在此处查看更多详细信息:https:// developers.google .com / appengine / docs / php / config / mod_rewrite

Further: 进一步:

Writing to local files is not supported in App Engine due to the distributed nature of your application. 由于您的应用程序具有分布式性质,因此App Engine不支持写入本地文件。 Instead, data which must be persisted should be stored in the distributed datastore. 相反,必须保留的数据应存储在分布式数据存储中。 For more information see the documentation on the runtime sandbox 有关更多信息,请参见运行时沙箱上的文档。

An App Engine application cannot: App Engine应用程序不能:

write to the filesystem. 写入文件系统。 Applications must use the App Engine datastore for storing persistent data. 应用程序必须使用App Engine数据存储区来存储持久性数据。 Reading from the filesystem is allowed, and all application files uploaded with the application are available. 允许从文件系统读取,并且随应用程序上载的所有应用程序文件均可用。

open a socket or access another host directly. 打开套接字或直接访问其他主机。 An application can use the App Engine URL fetch service to make HTTP and HTTPS requests to other hosts on ports 80 and 443, respectively. 应用程序可以使用App Engine URL提取服务分别向端口80和443上的其他主机发出HTTP和HTTPS请求。

spawn a sub-process or thread. 产生一个子进程或线程。 A web request to an application must be handled in a single process within a few seconds. 对应用程序的Web请求必须在几秒钟内通过单个过程进行处理。 Processes that take a very long time to respond are terminated to avoid overloading the web server. 需要花费很长时间进行响应的进程将终止,以避免Web服务器过载。

make other kinds of system calls. 进行其他类型的系统调用。

GAE provides a stream wrapper for Google Cloud Storage which makes using the service very simple. GAE为Google Cloud Storage提供了一个流包装器,使使用该服务非常简单。 Assuming you have completed the prerequisites files on GCS may be accessed using standard PHP file handling functions as shown in the documentation. 假设您已经完成了GCS上的先决条件文件,可以使用文档中所示的标准PHP文件处理功能进行访问。

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

I think the code in HumanReadableCache.php needs to be changed to use gs://bucket/file for cache implementation. 我认为HumanReadableCache.php中的代码需要更改为使用gs:// bucket / file来实现缓存。 (apiVersionMap AUTO GENERATED FILE ) I am not really a OOP_PHP programmer to replace/edit code in HumanReadableCache.php so could you please help and to come up with GAE version of Restler? (apiVersionMap AUTO GENERATED FILE)我不是真正的OOP_PHP程序员,要替换/编辑HumanReadableCache.php中的代码,所以请您帮忙并提出GAE版本的Restler吗? Thanks a lot. 非常感谢。

Could you try using RC6 which has modified version of HumanReadableCache which does not check for file writability 您是否可以尝试使用RC6,它已修改了HumanReadableCache版本,该版本不检查文件可写性

in your index.php do the following to map the saving of data gs path 在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