Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 谷歌应用引擎是否忽略了我的设置路径?_Php_Google App Engine - Fatal编程技术网

Php 谷歌应用引擎是否忽略了我的设置路径?

Php 谷歌应用引擎是否忽略了我的设置路径?,php,google-app-engine,Php,Google App Engine,在过去和当前版本的PHP中,我能够为如下库设置路径: define("ROOT", dirname(__FILE__)); set_include_path(ROOT . DIRECTORY_SEPARATOR . "libraries" . DIRECTORY_SEPARATOR . "smarty" . PATH_SEPARATOR . get_include_path()); require_once "Smarty.class.php"; spl_autoload_register(

在过去和当前版本的PHP中,我能够为如下库设置路径:

define("ROOT", dirname(__FILE__));
set_include_path(ROOT . DIRECTORY_SEPARATOR . "libraries" . DIRECTORY_SEPARATOR . "smarty" . PATH_SEPARATOR . get_include_path());
require_once "Smarty.class.php";
spl_autoload_register(
    function($class) {
        if (!class_exists($class)) {
            require_once("$class.php");
        }
    }
);
$smarty = new Smarty();
etc...
这样做效果很好:

define("ROOT", dirname(__FILE__));
set_include_path(ROOT . DIRECTORY_SEPARATOR . "libraries" . DIRECTORY_SEPARATOR . "smarty" . PATH_SEPARATOR . get_include_path());
require_once "Smarty.class.php";
spl_autoload_register(
    function($class) {
        if (!class_exists($class)) {
            require_once("$class.php");
        }
    }
);
$smarty = new Smarty();
etc...
然而,现在我正在尝试使用谷歌应用程序引擎,我必须:

require_once ROOT . DIRECTORY_SEPARATOR . "libraries" . DIRECTORY_SEPARATOR . "smarty" . DIRECTORY_SEPARATOR . "Smarty.class.php";
我的自动加载器功能不再适用于其他各种库

在控制台日志中,我得到以下信息:

PHP Fatal error:  require_once(): Failed opening required 'Smarty.class.php' (include_path='/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/source:/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/libraries/smarty:/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/libraries/swift:/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/libraries/html-purifier:/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/libraries/xhprof_lib:/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/source/modules/main:.;/base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/;/base/data/home/runtimes/php/sdk') in /base/data/home/apps/s~shiftedbits-cms/1.375217798547404203/bootstrap.php on line 70
尽管Smarty.class.php已明确上传并位于
/base/data/home/apps/s~shiftedbits cms/1.375217798547404203/libraries/Smarty

在正常情况下,PHP很容易找到它

我是否需要对app.yaml文件(如下)做一些特殊的处理,以允许PHP读取这些文件,或者对实例的限制太多,我需要找到另一种方法

application: shiftedbits-cms
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:
# Serve images as static resources.
- url: /(.+\.(gif|png|jpg|ico))$
  static_files: \1
  upload: .+\.(gif|png|jpg|ico)$

- url: /resources
  static_dir: resources

- url: /index\.html
  script: index.php

- url: /
  script: index.php

- url: /(.+)$
  script: index.php`

您必须使用调试工具并找到“ROOT”常量的解析结果。然后将根目录替换为基本路径

不确定它是否与您的主要问题有关,但您是否注意到您的包含路径似乎混合了unix路径分隔符(“:”)和windows路径分隔符(“;”)


(很抱歉将此作为回答,我的声誉仍然太低,无法发表评论:/)

您如何知道“Smarty.class.php被清晰地上传并位于…”的事实是正确的?如果我没有更改任何其他内容,但是
要求一次“Smarty.class.php”
阅读
要求一次/full/path/to/Smarty.class.php”
然后错误消失并继续。文件就在那里。为了缩小问题的范围,你能试试三种方法吗?1) 暂时使用绝对路径。2) 使用include而不是require(仅用于测试)。3) 将's~'预先挂起到您的ID(同样,只是为了排除这种可能性)应用程序引擎具有自动类加载功能,因此您不需要require_once-@George:1。)如问题中所述,这已经被证明是有效的,即使是require_once。问题是GAE在包含路径中找不到文件,尽管存在适当的路径。2.)我得到了以下日志:
17:04:54.253 PHP警告:include():apc未能在第70行找到Smarty.class.PHP-bailing-in/base/data/home/apps/s~shiftedbits-cms/1.375305376631267622/bootstrap.PHP
3。)看起来已经找到了。你能澄清一下我应该把它放在哪里吗?