Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer issues under Windows when installing from zip #2712

Closed
steve-todorov opened this issue Feb 17, 2014 · 6 comments
Closed

Composer issues under Windows when installing from zip #2712

steve-todorov opened this issue Feb 17, 2014 · 6 comments

Comments

@steve-todorov
Copy link

Hello there,

I've been experiencing some problems with composer. For some unknown reason, the installation/update fails on every project when I don't use --prefer-source. The exception I'm getting is that ZipArchive can't open the dependency file because the file is not existing. I did a lot of experimenting and this is not true. Composer downloads all project dependencies (as zip files) but as soon as it starts unzipping the first one, the zip file is deleted and it throws an exception.

I really have no more ideas what the heck is wrong here. I've tried removing the repo caches from the user home dir, uninstalling and installing composer again, checked if ZipArchive is actually available in my php installation. Everything seems to be exactly as it should be.

Here is some information regarding my system:

  • Windows 7x64 SP1
  • php-5.5.7-nts-Win32-VC11-x86
  • PHP has Zip enabled!

composer.json:

"require"    : {
    "doctrine/orm"        : "2.4.*",
    "symfony/class-loader": "2.4.*",
    "symfony/http-foundation": "2.4.*",
    "twig/twig"           : "1.15.*",
    "monolog/monolog"     : "1.7.*"
}

This is the output when trying composer install:

php C:\ProgramData\ComposerSetup\bin\composer.phar  --optimize-autoloader --working-dir=D:\htdocs\my-application-name -vvv --no-dev install
Reading ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/p-provider-active.json from cache
Downloading https://packagist.org/p/provider-latest$a8ed991afce0678fd5a6545f7057105e4c0d8d602a212fe8edff212b44fc255a.json
Writing C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/p-provider-latest.json into cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/p-provider-stale.json from cache
Installing dependencies
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$orm.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$class-loader.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$http-foundation.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-twig$twig.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-monolog$monolog.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$collections.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$dbal.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$console.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$common.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$doctrine-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$monolog-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$twig-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$doctrine-abstract-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$doctrine-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$framework-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$monolog-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$swiftmailer-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$twig-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$web-profiler-bundle.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$browser-kit.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$config.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$css-selector.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$dependency-injection.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$dom-crawler.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$event-dispatcher.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$finder.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$form.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$http-kernel.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$locale.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$process.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$routing.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$serializer.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$templating.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$translation.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$validator.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$yaml.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-lenybernard$symfony.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-swiftmailer$swiftmailer.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$swiftmailer-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$propel1-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$filesystem.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$options-resolver.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-psr$log.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$property-access.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$stopwatch.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$icu.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$debug.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$intl.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$proxy-manager-bridge.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$expression-language.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security-acl.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security-core.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security-csrf.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$security-http.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-symfony$symfony.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$inflector.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$cache.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$lexer.json from cache
Reading C:/Users/MyUser/AppData/Local/Composer/repo/https---packagist.org/provider-doctrine$annotations.json from cache
  - Installing psr/log (1.0.0)
Reading C:/Users/MyUser/AppData/Local/Composer/files/psr/log/fe0936ee26643249e916849d48e3a51d5f5e278b.zip from cache
    Loading from cache
    Extracting archive

    REASON: monolog/monolog 1.7.0 requires psr/log ~1.0 -> satisfiable by psr/log[1.0.0].

  - Installing monolog/monolog (1.7.0)
Reading C:/Users/MyUser/AppData/Local/Composer/files/monolog/monolog/6225b22de9dcf36546be3a0b2fa8e3d986153f57.zip from cache
    Loading from cache
    Extracting archive

    REASON: Required by root: monolog/monolog

  - Installing twig/twig (v1.15.1)
Reading C:/Users/MyUser/AppData/Local/Composer/files/twig/twig/1fb5784662f438d7d96a541e305e28b812e2eeed.zip from cache
    Loading from cache
    Extracting archive

    REASON: Required by root: twig/twig

  - Installing doctrine/lexer (v1.0)
Reading C:/Users/MyUser/AppData/Local/Composer/files/doctrine/lexer/2f708a85bb3aab5d99dab8be435abd73e0b18acb.zip from cache
    Loading from cache
    Extracting archive

    REASON: doctrine/common v2.4.1 requires doctrine/lexer 1.* -> satisfiable by doctrine/lexer[v1.0].

  - Installing doctrine/annotations (v1.1.2)
Downloading https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670
    Downloading: connection...    Downloading: 0%        Downloading: 60%    Downloading: 100%
Writing C:/Users/MyUser/AppData/Local/Composer/files/doctrine/annotations/40db0c96985aab2822edbc4848b3bd2429e02670.zip into cache
    Extracting archive



  [ErrorException]                                                             
  ZipArchive::extractTo(vendor/composer/4b03375e/doctrine-annotations-40db0c9\tests\Doctrine\Tests\Common\Annotations\Fixtures/AnnotationWithRequiredAttributesWithoutContructor.php): failed to open stream: No such file or directory                                                                         



Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:75
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 ZipArchive->extractTo() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:75
 Composer\Downloader\ZipDownloader->extract() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ArchiveDownloader.php:43
 Composer\Downloader\ArchiveDownloader->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/DownloadManager.php:183
 Composer\Downloader\DownloadManager->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:155
 Composer\Installer\LibraryInstaller->installCode() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:86
 Composer\Installer\LibraryInstaller->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:153
 Composer\Installer\InstallationManager->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:140
 Composer\Installer\InstallationManager->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:515
 Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:210
 Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:892
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:15


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
@steve-todorov
Copy link
Author

After 3 days of hard debugging I've actually found what the problem was - the path length was bigger than what windows allows. I honestly never thought this could be the problem, as I'm working with linux distributions most of the time! The path limit in windows 7 is around 260 characters, whoever there is a workaround - you could use \\?\ in the beginning of the path. Unfortunately I couldn't get this to work with composer (\ needs to become \ so it could work in php, and I don't know what that is transformed to in Symfony/Console).

In other words, if you're using composer under windows and the path is long - you're pretty much screwed. The only possible other workaround is to make a junction which is like link in linux to shorten the path length (if possible)

Source:
http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
http://en.wikipedia.org/wiki/NTFS_junction_point

@Seldaek
Copy link
Member

Seldaek commented Feb 18, 2014

Note that long path support on windows should be fixed in the upcoming PHP 5.6

@steve-todorov
Copy link
Author

It will be great if they fix it in 5.6. I will try the current alpha 2 to see if they haven't already. I wasn't aware they had plans on fixing it. Thank you for sharing! :)

@Seldaek
Copy link
Member

Seldaek commented Feb 18, 2014

I'd be happy to get confirmation that it is indeed fixed so if you test
let me know please :)

@steve-todorov
Copy link
Author

I've deleted my previous comment so that people don't get confused. I managed to get the SSL certificate validation working in PHP 5.6 alpha 2. After reading the RFC regarding the TLS support, I've spotted the openssl.cafile setting. Setting an absolute path to a CA bundle fixes the exception below:

[Composer\Downloader\TransportException]                                    
The "https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:                                  
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed                                                                      
Failed to enable crypto                                                     
failed to open stream: operation failed 

Unfortunately, they still haven't fixed the long paths in alpha2 x86 and x64. I still get the same exception as before. Hopefully they eventually fix it.

Edit: Just tested it with alpha3 (x86 and x64) - there is no change. The problem is still there.

@Seldaek
Copy link
Member

Seldaek commented Feb 18, 2014

Ping @pierrejoye any news regarding long path support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants