【发布时间】:2017-11-23 15:50:42
【问题描述】:
由于某种原因,这在我的本地开发服务器上完美运行,但是当我将其部署到谷歌时,我收到以下错误:
PHP 致命错误:在第 10 行的 /base/data/home/apps/../2.105209891175321430/library/testerson.php 中找不到类 'PHPOnCouch\couchClient'
有谁知道为什么我不会在本地与部署中遇到冲突的错误?
这是我的文件夹结构:
project folder
- app.yaml
- library/
- vendor/
- index.php
/library/testerson.php
<?php
namespace testerson;
use PHPOnCouch\couchClient as couchClient;
class Testerson {
public function __construct()
{
$this->CLOUDANT_URL = "https://user:pass@url.cloudant.com";
$this->global_client = new couchClient($this->CLOUDANT_URL, 'global');
}
}
?>
/index.php
<?php
require_once("vendor/autoload.php");
require_once("library/testerson.php");
use testerson\Testerson;
$account = new Testerson();
?>
【问题讨论】:
-
你能告诉我们你的应用程序的一般结构吗?应用引擎项目部署和引用的所有文件必须与 app.yaml 文件位于同一文件夹或更深的文件夹中,即 -app_folder --app.yaml --app_folder_library/autoload.php -library --autoload1.php 在此示例中, autoload1.php 不能在您的应用程序中被引用。只能引用 app_folder 下的文件。
-
@dwelling 我已经更新了我的文件夹结构。我还想指出,在 GCP 上的 Stackdriver Debug 中,所有文件都已正确部署。我从来没有遇到过这个问题,它与 GoogleAppEngineLauncher 一起工作,但实际上在部署时没有
标签: php google-app-engine google-app-engine-php google-app-engine-launch