Composer安装错误 - 文件不在允许的路径中

khe*_*nik 2 symfony composer-php

我正在尝试在Windows上安装composer(symfony 2项目).问题是我总是遇到一些错误 - 一些文件不在允许的路径中.

我尝试了几种安装compsoer的方法:

  1. 下载raw composer.phar文件,将其放入symfony2根文件夹并运行composer安装命令.它给了我一个错误,usr /.../ composer/.htaccess不在允许的路径内
  2. php -r"path"给出与上面类似的结果,但更多的"不在允许的路径中"错误
  3. Windows安装程序 - 它会抛出安装程序无法执行php.exe文件的错误,不明白为什么.

怎么了?

Nic*_*ich 6

调整open_basedir的php.ini包括路径到您的项目和作曲家试图从/写加载其他路径.该变量接受由:(unix)或;(windows)分隔的多个路径.

open_basedir = "/home/sites/yoursites/:/tmp/:/"
Run Code Online (Sandbox Code Playgroud)

...或完全从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 = 
Run Code Online (Sandbox Code Playgroud)

您可以使用以下命令找到CLI sapi的正确php.ini的位置:

php --ini
Run Code Online (Sandbox Code Playgroud)