2

I installed composer using curl and now I try to create laravel project, but I have error after enter command

 composer create-project laravel/laravel test-project --prefer-dist                                                                                     
PHP Warning:  Phar::mapPhar(): open_basedir restriction in effect. File(/usr/local/bin/composer) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/) in /usr/local/bin/composer on line 13
PHP Warning:  require(phar://composer.phar/bin/composer): failed to open stream: phar error: invalid url or non-existent phar "phar://composer.phar/bin/composer" in /usr/local/bin/composer on line 15
PHP Fatal error:  require(): Failed opening required 'phar://composer.phar/bin/composer' (include_path='.:/usr/share/pear') in /usr/local/bin/composer on line 15
waldemar
  • 655
  • 2
  • 10
  • 24

3 Answers3

7

There is different solutions for your problem.

How did you install php ? Are you the admin of your system ? If so, please edit your php.ini to add /usr/local/bin/ to allowed path in open_basedir.

ChainList
  • 1,198
  • 7
  • 28
1

If its helps, I added my /home/user/.composer/vendor/bin/ to my open_basedir option in /etc/php/php.ini

And then also add this directory to my PATH, I don't know if this is secure or appropiate... Works on ArchLinux!

elotgamu
  • 43
  • 10
1

first you have to copy composer.phar "cp composer.phar /usr/local/bin/composer" and "cp composer.phar /usr/bin/composer"

after add :/usr/local/bin/composer:/usr/bin/composer to open_basedir option in /etc/php/php.ini

Armandof
  • 31
  • 2