I am trying to use composer install with symfony2. But I keep running into this issue time and again.
When I run:
php composer.php install
I get the following errors that I do not know how to fix:
Error #1
[Symfony\Component\Debug\Exception\ContextErrorException]
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/MAMP/htdocs/ffss/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection/Configuration.php line 66
Error #2
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
Error #3
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
This is line 66 of the file mentioned in the 1st error:
->scalarNode('default_timezone')->defaultValue(date_default_timezone_get())->end()
Thanks for your help!
just set the default timezone in in your app/AppKernel.php
file like this:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
// setting the default time zone
date_default_timezone_set('UTC');
class AppKernel extends Kernel
{
// what ever bundles registered
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
Please run php -i
and grab the location of the mentioned php.ini
file in the output. That file needs the setting mentioned in the error message added. There probably already is some commented line with this name.
All other errors are triggered by the first one and shouldn't be triggered once the required PHP setting is done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With