繁体   English   中英

php运行shell脚本

[英]php run shell script

我正在尝试从php前端运行shell脚本

下面是shell文件(run.sh chmod到777)

#!/bin/bash
wget -O index.html http://markets.usatoday.com/custom/usatoday-com/html-mktscreener.asp
python hw7-9.py index.html 
echo "done";

继承了php前端

<?php
   $output = shell_exec("run.sh");
   echo "<pre>$output</pre>";
?>

但它的php页面除了返回任何内容

<pre></pre>

你试过做error_reporting(-1); 在PHP脚本的顶部。 可能在您的服务器上禁用了shell_exec

你会尝试$ output = shell_exec(“sh run.sh”);

检查php / web服务器实际运行的用户 - 例如“www-user”可能没有任何权限来执行脚本尝试执行的操作(并且有充分的理由)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM