我有一个像这样的基本PHP脚本:
<?php
system("/bin/touch /root/testfile");
Run Code Online (Sandbox Code Playgroud)
当我从命令行运行此PHP脚本时:
# php myscript.php
Run Code Online (Sandbox Code Playgroud)
我明白了:
sh: /touch: No such file or directory
Run Code Online (Sandbox Code Playgroud)
此外,触摸是在正确的位置:
# which touch
/bin/touch
Run Code Online (Sandbox Code Playgroud)
我需要在PHP脚本中设置有关路径的东西吗?因为它找不到触摸(即使我用它的绝对路径专门调用它).
UPDATE
运行/bin/touch /root/testfile命令行如预期正常工作.
此外,touch是不工作,是的,但其他事情也不行,例如sendmail.我只是touch在这个问题中使用它来保持简单.
| 归档时间: |
|
| 查看次数: |
1288 次 |
| 最近记录: |