0

I'm trying to use composer on my local development machine, and it always fails when trying to copy something from the PHAR archive:

[ErrorException]
copy(): open_basedir restriction in effect. File(phar://E:/xampp/php/composer/composer.phar/src/Composer/Autoload/ClassLoader.php) is not within the allowed path(s)

E:\xampp\php\composer is included in the open_basedir directive, reading and writing files in that location works fine, only accessing files in the PHAR archive doesn't work. I've tried adding the following paths:

E:\xampp\php\composer\composer.phar\src\
phar://E:/xampp/php/composer/
phar://E:/xampp/php/composer/composer.phar/src/
phar://E:/xampp/php/composer/composer.phar/src/Composer/Autoload/

but none of it helps, it's still failing with the same error.

Is there a special way to include paths to PHAR archives? Is it possible at all? Should it be neccessary anway? Might this have something to do with this bug: https://bugs.php.net/bug.php?id=64634 ?

My system: Windows 7 x64, XAMPP 1.8.1, Apache 2.4.3, PHP 5.4.7

Update: Tried the latest stable PHP 5.4.14 too, same problem.

emjay
  • 1,491
  • 5
  • 17
  • 35
ndm
  • 59,784
  • 9
  • 71
  • 110

1 Answers1

1

I managed to reproduce it and the workaround using stream_copy_to_stream seems to work, so I applied that in 566313834af3a49cd3f6b41001f7d8549e0b9c96 and if you run composer self-update it should now work.

I am not too sure which other parts of composer might be affected by this, but if you still have similar issues feel free to open a bug report on github.

Seldaek
  • 40,986
  • 9
  • 97
  • 77
  • Thanks for the ultra fast fix/workaround, it's working fine now :) So since **stream_copy_to_stream** works in this case too I guess that also answers the question, ie it's actually the mentioned PHP bug causing the problem. – ndm Apr 28 '13 at 15:25