Jenkins 的 PHP 构建失败并出现“无法运行程序“phploc""

尝试运行构建脚本时出现以下错误.

I'm getting the following error when attempting to run my build script.

/var/lib/jenkins/jobs/IPS (trunk)/workspace/build.xml:62: Execute failed: java.io.IOException:  
Cannot run program "phploc": java.io.IOException: error=2, No such file or directory

我尝试切换到 jenkins 用户并且能够顺利运行脚本.我还检查了 $PATH 并尝试重新安装.运气不好!

I tried switching to the jenkins user and was able to run the script without a hitch. I also checked the $PATH and tried reinstalling. No luck!

  • CentOS 5/6
  • PHP 5.4(Zend 服务器)
  • 詹金斯 1.477
  • PHP QA 组件(最新)

推荐答案

我终于想通了...检查 $PATH 变量在这种情况下没有帮助.运行 Jenkins 作业时不执行各种 shell 启动文件,因此未正确填充 $PATH 变量.这可以通过以下三个步骤来解决:

I finally figured this out... checking the $PATH variable is not helpful in this context. The various shell startup files are not executed when running a Jenkins job, so the $PATH variable was not being properly populated. This can be remedied by following the three steps below:

  1. 点击管理 Jenkins
  2. 点击配置系统
  3. 添加名称为 PATH 且值为 $PATH:/usr/local/zend/bin 的新环境变量.
  1. Click Manage Jenkins
  2. Click Configure System
  3. Add new environment variable where name is PATH and value is $PATH:/usr/local/zend/bin.

相关文章