在azure web app上托管symfony2应用程序

在azure web app上托管symfony2应用程序

问题描述:

i have a problem hosting a symfony2 app on azure. It am always getting an "Failed to write cache file" error in Filesystem.php. I guess that php does not not have the permission to write to the cache folder. How can i give php the permisson to modify the cache, without webdeploy or git, i only have ftp and the azure management portal.

KR Manuel

我在azure上托管symfony2应用程序时遇到问题。 它始终在Filesystem.php中收到“无法写入缓存文件”错误。 我猜php没有写入缓存文件夹的权限。 如何在没有webdeploy或git的情况下给php提供缓存的权限,我只有ftp和天蓝色的管理门户。 p>

KR Manuel p> div >

You have to set the correct directories for logs and cache in your Kernel. And you can usually set permissions for that folder using your FTP client.

public function getCacheDir()
{
    if ($this->getEnvironment() == 'prod') {
        return 'D:\\home\\data\\cache\\prod';
    }
    return parent::getCacheDir();
}

public function getLogDir()
{
    if ($this->getEnvironment() == 'prod') {
        return 'D:\\home\\LogFiles\\app\\';
    }
    return parent::getLogDir();
}

there is also a pre-made bundle to take care of these things: https://github.com/brainsonic/AzureDistributionBundle

and even a detailed tutorial: http://symfony.com/doc/current/cookbook/deployment/azure-website.html