我正在使用Google (GAE)进行web开发,也使用Smarty模板引擎。
由于GAE不支持编写文件,所以我遇到了人们提出的这个问题,我试用了gs://,这是用于智能模板缓存文件的google桶。下面的链接显示了我用来放置模板缓存文件的解决方案。
smarty and PHP Google Application Engine compatibility
因此,我创建了存储桶,并在其中创建了为smarty创建的缓存文件。
这是我的index.php,如下所示。
<?php
require 'libs/Smarty.class.php';
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$smarty = new Smarty;
//$smarty->force_compile = true;
//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 120;
$smarty->assign("Name","Hello");
$smarty->compile_dir= "gs://abctesting.appspot.com/achievotmp/compiled/";
$smarty->cache_dir="gs://abctesting.appspot.com/achievotmp/cache/";
$smarty->display('index.tpl');
?>我填充了app_id ( and测试),我把它部署到服务器上,我点击刷新域名。第一批负载工作得很好。我可以看到所需的输出,但是当我再次点击refresh时,这个错误就会出现。*请注意,app_id是虚构的,我避免让用户意识到我的app_id由于隐私,因为我使用我的全名,这是非常愚蠢的。很抱歉给您带来不便。这只是为了发展。一旦一切正常并设置好,我将再次更改命名。
显示的错误:
警告: /base/data/home/apps/s~abctesting/1.376690645530467087/libs/sysplugins/smarty_internal_templatebase.php中的allow_url_include=0在第160行的服务器配置中禁用了include(gs://abctesting.appspot.com/achievotmp/compiled/c0360d049dff10f364dfc53ba2cc3958abf6ee6d.file.index.tpl.php):():gs://包装器,警告:include(gs://abctesting.appspot.com/achievotmp/compiled/c0360d049dff10f364dfc53ba2cc3958abf6ee6d.file.index.tpl.php):未能打开流:在/base/data/home/apps/s~abctesting/1.376690645530467087/libs/sysplugins/smarty中找不到合适的包装器第160行的_internal_templatebase.php警告:_internal_templatebase.php():打开包含的_internal_templatebase.php失败(_internal_templatebase.php_path=‘.;/base/data/home/apps/s~abctesting/1.376690645530467087/;/base/data/home/runtimes/php/sdk') in /base/data/home/apps/s~abctesting/1.376690645530467087/libs/sysplugins/smarty_internal_templatebase.php in第160行致命错误: Uncaught > Smarty:在第176行的/base/data/home/apps/s~abctesting/1.376690645530467087/libs/sysplugins/smarty_internal_templatebase.php中抛出的index.tpl<-编译模板无效
这同样适用于本地主机开发。我想这就是编译后的文件不知怎么出错的问题。
我有搜索通过互联网和提出的问题,与谷歌应用程序引擎智能集成是相当有限的。此外,我只想使用免费配额,使我不会有任何额外的收费。我还读了一些关于APC扩展和一些memCache的内容,但我还没有尝试过。它看起来也很复杂,我需要在这方面的指导。
请帮忙,因为我在这方面真的是个新手。有什么解决办法吗?
这也是我的app.yaml。
application: abctesting
version: 1
runtime: php
api_version: 1
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /scripts
static_dir: scripts
mime_type: text/javascript
- url: /.*
script: index.php请提前告知并感谢!
发布于 2014-06-22 07:23:17
我已经找到了答案。首先,感谢火星的提示。
将需要将php.ini与app.yaml一样包含在根指令中。
allow_url_include = "1"
google_app_engine.allow_include_gs_buckets = "abctesting.appspot.com/achievotmp/compiled/,abctesting.appspot.com/achievotmp/cache/"我将这两行添加到php.ini中,然后错误就全部消失了。我想以前不允许使用allow目录。
希望这对遇到这个问题的人也有帮助。
谢谢。
https://stackoverflow.com/questions/24332453
复制相似问题