Google App Engine无法打开SMARTY php脚本

时间:2014-11-24 08:36:31

标签: php google-app-engine smarty yaml google-cloud-sql

  

我正在使用Google App Engine(GAE)进行网站开发,还使用Smarty   HTML模板引擎。

     

这是我在include.php中使用的代码段。我部署后   它向我显示没有输出并向我显示这些日志。

<?php
include_once(dirname(dirname(__FILE__)) . '/includes/configs/config.inc.php');

if (!isset($_SESSION))
    session_start();

$_SESSION['timestamp'] = time();

if (isset($_SESSION['auth']) && $_SESSION['auth'] === true)
    $authStatus = true;

include_once(INCLUDE_DIR . '/library/util.php');
include_once(INCLUDE_DIR . '/library/connection.php');
include_once(CLASSES_DIR . 'db.class.php');
include_once(INCLUDE_DIR . '/langs/en.lang.php');
include_once(INCLUDE_DIR . '/helpers/browserDetect.class.php');
  

这将是我的退出

PHP警告:include_once():open_basedir限制生效。文件(/ base / data / home / apps / s~ /includes/configs/config.inc.php)不在允许的路径中:(/ base / data / home / apps / s~ < /strong>/1.380323599570411257/ ;/base/data/home/runtimes/php/sdk;/php_runtime/versions;/etc)/base/data/home/apps/s~**/1.380323599570411257/includes.php on line 2

PHP警告:include_once(/ base / data / home / apps / s~ /includes/configs/config.inc.php):无法打开流:/ base / data / home /中不允许操作第2行的app / s~ /1.380323599570411257/includes.php

  

这将是我的app.yaml

application: ***
version: 1
runtime: php
api_version: 1

handlers:
- url: /css
  static_dir: css

- url: /images
  static_dir: images

- url: /js
  static_dir: js

- url: /
  script: index.php

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

2 个答案:

答案 0 :(得分:1)

  

我将app.yaml文件放在docroot之外。   我将app.yaml更新为这样的东西,它对我有用

application: creditcard-deals
version: 1
runtime: php
api_version: 1

handlers:
- url: /css
  static_dir: css

- url: /images
  static_dir: images

- url: /js
  static_dir: js

- url: /(.*/)?.*\.tpl
  mime_type: application/vnd.trid.tpt
  static_files: tpl
  upload: static/(.*\.tpl)

- url: (.+).php
  script: \1.php

- url: /.*
  script: /docroot/index.php

答案 1 :(得分:0)

您对dirname的调用过多,请尝试

<?php
include_once(dirname(__FILE__) . '/includes/configs/config.inc.php');