沃梦达 / 编程问答 / php问题 / 正文

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

PHP build for Jenkins failing with #39;Cannot run program quot;phplocquot;#39;(Jenkins 的 PHP 构建失败并出现“无法运行程序“phploc)

本文介绍了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.

这篇关于Jenkins 的 PHP 构建失败并出现“无法运行程序“phploc""的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Jenkins 的 PHP 构建失败并出现“无法运行程序“phploc""

基础教程推荐