doujin4031
2016-08-02 15:58
浏览 156
已采纳

使用ansible抛出错误来运行php脚本

I am trying to run a php script on a remote server using ansible. Running the script with the ansible user (which ansible uses to login to the server) works perfectly. The ansible task however fails when there are include statements in my php script.

My php script lays in

/srv/project

it tries to include

includes/someLibrary.php
Everything works fine when running the script as any user with the correct access rights but when running it via an ansible task
- name: run script
  shell: 'php /srv/project/script.php'

it fails with:

failed to open stream: No such file or directory in /srv/project/includes/someLibrary.php

Running a very basic php script works nicely though.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用ansible在远程服务器上运行php脚本。 使用ansible用户运行脚本( ansible用于登录服务器的工作完美。 然而,当我的php脚本中包含语句时,ansible任务失败。

我的php脚本位于

 / srv / project  
 
  

尝试包含

 includes / someLibrary.php  
当所有用户都具有正确的访问权限但通过ansible任务运行时,所有工作都正常工作
 \  n 
 
- name:运行脚本
 shell:'php /srv/project/script.php'
nn

失败:

 无法打开流:/srv/project/includes/someLibrary.php中没有这样的文件或目录 
 
 

运行一个非常基本的PHP脚本可以很好地工作。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题