dsjfrkvn818747 2015-09-19 04:06
浏览 69

你不能运行PHP脚本

I have a problem when you run a script from php the problem is that it doesn't do what must be done, this is the php code

? php
echo "starting execution";
echo exec("./sc");
?>

and in the code of the script this is sc

mv text.txt /var/www/files/

does not work does not move the file archive there is I've added the chmod permismos but doesn't appreciate any suggestion

  • 写回答

1条回答 默认 最新

  • douzizang7783 2015-09-19 04:19
    关注

    First, I would suggest to execute the script file manually from command line(console) and check if the script file is working properly. If that doesn't work, then it won't work in php too.

    Try:

    echo "starting execution";
    echo exec("./sc", $output);
    var_dump($output);
    

    contents of sc :

    mv text.txt /var/www/files/ 2>&1
    

    If the file is not moved, it must throw an error which you should be able to see in $output.

    My guess would be that the error must be related to permission.

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?