我使用php shell_exec从jQuery运行命令,但它保持超时。500(内部服务器错误)php shell_exec
所以我的jQuery如下。
var send = {
url: $(this).data('url')
}
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>index.php/upload",
data: send,
//dataType: "json",
//timeout: 8000,
beforeSend: function() {
},
success: function(response) {
console.log(response);
},
error: function() {
alert('error');
}
});
这就要求它运行了shell_exec函数
function upload(){
$output = shell_exec("wget {$_POST['url']} 2>&1");
echo "<pre>" . $output . "</pre>";
}
确定这是否是贴wget的获取URL拉着一个小文件,工作正常,但如果wget获取文件说超过20MB我得到500(内部服务器错误)
我已经检查过的东西到目前为止 所有我的php设置文件上传限制最大文件大小等内存限制所有我已设置为最大。
我没有得到的东西在当地工作正常,但在我的主机上我得到这个错误,我已经联系我的主机媒体寺庙,他们说已经超出了他们的支持范围。
有关如何进一步调试的任何建议?
我会在['set_time_limit(0);'](http://php.net/set-time-limit)上修正它100英镑。 (把它作为PHP'upload()'函数的第一行) – DaveRandom
也要注意你正在做的事情有巨大的安全隐患。 – DaveRandom
@DaveRandom @DaveRandom我想看看你的赌注如何... – Baba