khernik
khernik

Reputation: 2091

Composer installation error - file is not within the allowed path

I am trying to install composer on windows (symfony 2 project). The problem is that I always get some strage errors - that a couple of files are not in the allowed path.

I've tried a couple of methods to install compsoer:

  1. Downloading raw composer.phar file, throwing it into the symfony2 root folder and running composer installation command. It gives me an error that usr/.../composer/.htaccess is not within the allowed path
  2. php -r "path" gives similar results as above, but with more "not in the allowed path" errors
  3. Windows installer - it throws an error that the installer couldn't execute php.exe file, no idea why.

What's wrong?

Upvotes: 5

Views: 4043

Answers (2)

Tony
Tony

Reputation: 1349

  • First, you should make sure that the path of php.exe is in your ENV (Environment variable);

  • Second, if composer's windows installer can't install, just try to use "Run With Administrator Permission", and if it also does not work, just comment me your error.

Upvotes: 1

Nicolai Fröhlich
Nicolai Fröhlich

Reputation: 52513

Adjust open_basedir in your php.ini to include the path to your project and the other paths that composer tries to load from/write to. The variable accepts multiple paths separated by : (unix) or ; (windows).

open_basedir = "/home/sites/yoursites/:/tmp/:/"

... or remove the restriction completely from php.ini.

; remove open_basedir completely ...
; <nothing here>

; ... comment it out like this ...
; open_basedir = "..." 

; ... or set it to an empty value like this ...
open_basedir = 

You can find the location of the correct php.ini for the CLI sapi with:

php --ini

Upvotes: 9

Related Questions