donglinli2027 2015-03-23 04:38
浏览 67

从bash脚本执行php脚本

First I tried other questions that may lead to an answer but failed. Anyway I have a problem executing a php script from a bash script and outputs the following error message: Could not open input file: /root/dir/file.php, I can execute the php script fine from terminal however I tried using the 2 following codes in the shell script to execute the php script:

wordpress="/etc/alternatives/php /root/dir"
$wordpress/file.php $input

and

php /root/dir/file.php

and they both failed, any help appreciated.

  • 写回答

1条回答 默认 最新

  • dpylt7626401 2015-03-23 04:47
    关注

    I'm guessing that your /root/dir means doc root. The kernel knows nothing about apache root dirs so does not know where to go. In the bash script you a) do not need to use a path to php, it is already registered b) you do need to use the absolute path to the script, unless it is in a directory that is listed in the PATH variable ( you can use a symlink asd well of course)

    So try

    php /absolute/path/to/script.php 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器