if I run the command in shell it will download it,No error by shell
but by PHP page always it goes to if statement
I tried shell_exec
and the result is the same
I really want to do it just by Wget
But if this is impossible and your solution is cURL
please tell it in more details then I can find out how to code it
$flag=system('wget -P /srv/www/htdocs/didebansnort/Downloads http://www.snort.org/reg-rules/snortrules-snapshot-2900.tar.gz/myoinkcodethatmustbesecret
');
if(!$flag)
{
echo '<script>alert("please try again!")</script>';
}
If the problem is about permissions How can I fix it?
suggestion was fopen but I have to download from command line If you think it is possible!
here is the site
https://www.snort.org/snort-rules/#rules
well for example by rightclick on snortrules-snapshot-2904.tar.gz I can have it now I think it is impossible by fopen how can I make access to it? I think solution is "just" 开发者_开发技巧download via command line in PHP I don't know!
Thanks
Are you sure your PHP config allows you to execute system() and that it allows you to run it as root?
Which user is the sudo running as? Does that user have passwordless access to root (if so, why!) You really need to avoid the sudo
bit, it's very probably failing. Just make sure the user PHP runs as can write to /srv/www/htdocs/didebansnort/Downloads (understanding the risks there-of) and run the wget without the sudo
.
Even better, why not use one of the built in methods of PHP to get a remote file? (fopen
?)
精彩评论