Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix an issue using composer.phar install

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()

  1. I dont know where to set the time zone it is requesting.
  2. I dont know where to begin to even fix this error: Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
  3. What does this even mean: An error occurred when executing the "'cache:clear --no-warmup'" command.

Thanks for your help!

like image 695
LargeTuna Avatar asked Mar 20 '23 03:03

LargeTuna


2 Answers

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');
    }
 }
like image 111
Ajeet Varma Avatar answered Mar 29 '23 00:03

Ajeet Varma


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.

like image 45
Sven Avatar answered Mar 29 '23 01:03

Sven