我正在尝试以 Jenkins 用户身份从 Jenkins 项目文件夹运行 Composer 安装程序。
/usr/local/bin/composer install
我收到消息了
Content-type: text/html
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Composer could not find a composer.json file in /usr/local/bin
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
我不知道为什么它在 usr/local/bin
中寻找 composer.json
。
如果我以 root 用户身份运行它,它就可以工作。有人可以解释我做错了什么吗?
这是我的环境
pwd
/var/lib/jenkins/workspace/project_staging
whoami
jenkins
最佳答案
您应该能够使用以下说明安装 Composer :
curl -sS https://getcomposer.org/installer | php56
为了避免任何问题
cd ~/bin
ln -s /usr/local/bin/php56 php
修改您的 ~/.bash_profile 文件并更改:
PATH=$PATH:$HOME/bin To `PATH=$HOME/bin:$PATH`
然后关闭您的 SSH session 并开始一个新 session ,或者运行:
source ~/.bash_profile
然后 ~/bin 路径将优先,您将使用正确版本的 PHP。
关于php - Jenkins 用户无法运行 composer install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50033297/