简体   繁体   English

如何使用composer.phar安装修复问题

[英]How to fix an issue using composer.phar install

I am trying to use composer install with symfony2. 我正在尝试使用symfony2进行composer安装。 But I keep running into this issue time and again. 但我一次又一次地遇到这个问题。

When I run: 当我跑:

php composer.php install php composer.php安装

I get the following errors that I do not know how to fix: 我得到以下错误,我不知道如何解决:

Error #1 错误#1

[Symfony\\Component\\Debug\\Exception\\ContextErrorException] [Symfony的\\元器件\\调试\\异常\\ ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. 警告:date_default_timezone_get():依赖系统的时区设置是不安全的。 You are required to use the date.timezone setting or the date_default_timezone_set() function. 需要使用date.timezone设置或date_default_timezone_set()函数。 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. 我们现在选择了时区'UTC',但请设置date.timezone以选择您的时区。 in /Applications/MAMP/htdocs/ffss/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection/Configuration.php line 66 在/Applications/MAMP/htdocs/ffss/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection/Configuration.php第66行

Error #2 错误#2

Script Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception 脚本Sensio \\ Bundle \\ DistributionBundle \\ Composer \\ ScriptHandler :: clearCache处理以异常终止的post-install-cmd事件

Error #3 错误#3

[RuntimeException] [RuntimeException的]
An error occurred when executing the "'cache:clear --no-warmup'" command. 执行“'cache:clear --no-warmup'”命令时发生错误。

This is line 66 of the file mentioned in the 1st error: 这是第1个错误中提到的文件的第66行:

->scalarNode('default_timezone')->defaultValue(date_default_timezone_get())->end() - > scalarNode( 'default_timezone') - >默认值(date_default_timezone_get()) - >端()

  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 我不知道从哪里开始甚至修复此错误:脚本Sensio \\ Bundle \\ DistributionBundle \\ Composer \\ ScriptHandler :: clearCache处理post-install-cmd事件以异常终止
  3. What does this even mean: An error occurred when executing the "'cache:clear --no-warmup'" command. 这甚至意味着什么:执行“'cache:clear --no-warmup'”命令时发生错误。

Thanks for your help! 谢谢你的帮助!

just set the default timezone in in your app/AppKernel.php file like this: 只需在app/AppKernel.php文件中设置默认时区,如下所示:

  <?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. 请运行php -i并在输出中获取提到的php.ini文件的位置。 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. 所有其他错误都由第一个错误触发,并且在完成所需的PHP设置后不应触发。

Found the solutions on this post: Link to the solution 在这篇文章中找到解决方案: 链接到解决方案

I tried to edit everyone one of the php.ini files on my system and restart apache/MAMP, no success. 我试图编辑我系统上的所有php.ini文件之一并重新启动apache / MAMP,但没有成功。

This is the only thing that I could get to work. 这是我唯一可以上班的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM