Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to install Symfony on XAMPP and I keep getting numerous errors.

[SymfonyComponentDebugExceptionContextErrorException]                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set 
date.timezone to select your timezone. in 
/Applications/XAMPP/xamppfiles/htdocs/vendor/monolog/monolog/src/Monolog/Logger.php line 233 

and then

Script SensioBundleDistributionBundleComposerScriptHandler::clearCache handling the post-
install-cmd event terminated with an exception

and finally

[RuntimeException]                                                         
An error occurred when executing the "'cache:clear --no-warmup'" command.

I've tried changing the date.timezone in my php.ini file and using the date_default_timezone_set() function in the command line before trying to install it and nothing seems to work.

I've been staring at it for a while so any help is appreciated

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
382 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you can't set it correctly in your php.ini for some reason then you can set it as the first thing in your AppKernel, like so..

class AppKernel extends Kernel
{
    public function __construct($environment, $debug)
    {
        date_default_timezone_set('Europe/London');
        parent::__construct($environment, $debug);
    }

    public function registerBundles()
    {
        $bundles = array(
            ....
        );
    }

    ....
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...