我是stackoverflow的新成員,我對Google雲和Symphony應用程序部署有一些疑問。我已閱讀https://cloud.google.com/appengine/docs/php/symfony-hello-world的文檔,並設法部署了Hello Word應用程序,但是當我嘗試使用我的symfoy應用程序時,出現了以下錯誤: XmlFileLoader.php中的InvalidArgumentException行259:無法解析文件「(...)DependencyInjection/../Resources/config\web.xml」。 在我的app.yaml我設置了ENV變量: env_variables: GCS_BUCKET_NAME: 「pinterpandaibucket」 的cache_dir: 「GS:// pinterpandaibucket/symfony中/高速緩存」 LOG_DIR: 「GS:// pinterpandaibucket/symfony中/日誌」 我重載AppKernel.php功能:將symfony應用程序部署到Google應用程序引擎
<?php
public function __construct($environment = null, $debug = null)
{
// determine the environment/debug configuration based on whether or not this is running
// in App Engine's Dev App Server, or in production
if (is_null($debug)) {
$debug = !Environment::onAppEngine();
}
if (is_null($environment)) {
$environment = $debug ? 'dev' : 'prod';
}
parent::__construct($environment, $debug);
// Symfony console requires timezone to be set manually.
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
// Enable optimistic caching for GCS.
$options = ['gs' => ['enable_optimsitic_cache' => true]];
stream_context_set_default($options);
$this->gcsBucketName = getenv('GCS_BUCKET_NAME');
...
public function getCacheDir()
{
if ($this->gcsBucketName) {
return getenv('CACHE_DIR');
}
return parent::getCacheDir();
}
public function getLogDir()
{
if ($this->gcsBucketName) {
return getenv('LOG_DIR');
}
return parent::getLogDir();
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
?>
該文件系統上寫的功能會被重定向到桶。你能幫我找到我的應用程序中缺少哪些修改。我希望這個主題能夠幫助別人,因爲Google雲文檔並不是最新的。如果我不會說英語,我會提前感謝您,並且很抱歉,我是一名法國IT學生。
奧古斯丁
這可能與GCS無關,因爲您仍然可以從文件系統讀取靜態文件。該應用程序應該嘗試加載/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml。可以肯定的是,你應該在問題中包含完整的錯誤信息而不是截斷版本。你可以將你的應用程序中的這個文件與工作的symfony-starter中的文件進行比較嗎?您是否將您的應用程序從工作初級應用程序中刪除,或者嘗試以不同方式嘗試使其在App Engine上運行? – Adam