1
votes

I am using Google App Engine (GAE) for web development and also Smarty html template engine.

This is the code segment that I use in my include.php. after I deploy it is showing me no out put and show me these logs.

<?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');

This would be my log out put

PHP Warning: include_once(): open_basedir restriction in effect. File(/base/data/home/apps/s~/includes/configs/config.inc.php) is not within the allowed path(s): (/base/data/home/apps/s~/1.380323599570411257/;/base/data/home/runtimes/php/sdk;/php_runtime/versions;/etc) in /base/data/home/apps/s~**/1.380323599570411257/includes.php on line 2

PHP Warning: include_once(/base/data/home/apps/s~/includes/configs/config.inc.php): failed to open stream: Operation not permitted in /base/data/home/apps/s~/1.380323599570411257/includes.php on line 2

This would be my 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

2 Answers

1
votes

I placed my app.yaml file outside the docroot. And I update app.yaml to something like this and it work for me

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
0
votes

You have too many calls to dirname, try

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