在Windows上安装Sylius - symfony3

时间:2017-07-20 15:21:10

标签: windows symfony sylius

当我执行此命令时

php bin/console sylius:install

我有这个

    C:\wamp\www\p>php bin/console sylius:install
Installing Sylius...

           ,
         ,;:,
       `;;;.:`
      `::;`  :`
       :::`   `          .'++:           ''.   '.
       `:::             :+',;+'          :+;  `+.
        ::::            +'   :'          `+;
        `:::,           '+`     ++    :+.`+; `++. ;+'    ''  ,++++.
         ,:::`          `++'.   .+:  `+' `+;  .+,  ;+    +'  +;  ''
          ::::`           ,+++.  '+` :+. `+;  `+,  ;+    +'  '+.
   ,.     .::::             .++` `+: +'  `+;  `+,  ;+    +'  `;++;
`;;.:::`   :::::             :+.  '+,+.  `+;  `+,  ;+   `+'     .++
 .;;;;;;::`.::::,       +'` `++   `++'   `+;  `+:  :+. `++'  '.  ;+
  ,;;;;;;;;;:::::       .+++++`    ;+,    ++;  ++, `'+++,'+' :++++,
   ,;;;;;;;;;:::`                  ;'
    :;;;;;;;;;:,                :.:+,
     ;;;;;;;;;:                 ;++

Step 1 of 4. Checking system requirements.
------------------------------------------

+----------------------------+-------------------------------------------------+
| Issue                      | Recommendation                                  |
+----------------------------+-------------------------------------------------+
| Version de PHP recommandée |                                                 |
| Accélérateur               | Activez le OpCache Zend (fortement recommandé). |
+----------------------------+-------------------------------------------------+
Success! Your system can run Sylius properly.

Step 2 of 4. Setting up the database.
-------------------------------------

Creating Sylius database for environment dev.
It appears that your database already exists.
Warning! This action will erase your database.
Would you like to reset it? (y/N) y
 0/5 [Γûæ                           ]   0%
 1/5 [ΓûæΓûæΓûæΓûæΓûæΓûæ                      ]  20%
 2/5 [ΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæ                ]  40%
 3/5 [ΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæΓûæ           ]  60%

  [Symfony\Component\Config\Exception\FileLoaderLoadException]
  Warning: glob(): Pattern exceeds the maximum allowed length of 260 characte
  rs in C:\wamp\www\p\src\Sylius\Bundle\AdminBundle/Resources/config/routing/
  admin_user.yml (which is being imported from "C:\wamp\www\p\src\Sylius\Bund
  le\AdminBundle/Resources/config/routing.yml").



  [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: glob(): Pattern exceeds the maximum allowed length of 260 characte
  rs


cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

请帮帮我!!!!

1 个答案:

答案 0 :(得分:3)

Sylius使用内联yaml资源格式(您可以通过搜索resource: |找到它),这种格式被Symfony 3.3路由错误地识别为glob模式。在Unix系统上没有问题,它对glob模式没有长度限制,但在Windows上中断(因为它有时超过260个字符)。

根问题在https://github.com/symfony/symfony/issues/22938中有更多背景描述,可以通过在\Symfony\Component\Config\Loader\FileLoader::import()中对glob模式识别中的换行添加检查来阻止这样做:

84:      public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
85:      {
86: -        if (is_string($resource) && strlen($resource) !== $i = strcspn($resource, '*?{[')) {
86: +        if (is_string($resource) && false === strpos($resource, "\n") && strlen($resource) !== $i = strcspn($resource, '*?{[')) {
87:              $ret = array();
88:              $isSubpath = 0 !== $i && false !== strpos(substr($resource, 0, $i), '/');

也可以通过重写所有内联yaml路由配置来修复Sylius,以避免使用字符*?{[。我发现只有像:

这样的数组
except: ['show']

可以改写为:

except:
    - 'show'

因此避免触发水珠模式识别。

我还没有找到任何其他解决方法。

通过注册表编辑(http://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/)删除Windows中的260个字符路径限制根本没有用。可能会在PHP本身中检查glob模式的260限制。