My script tries to exec() wget but seems to fail (though, no error raises up). What could be the problem? Should I tune PHP somehow? I just installed Apache and PHP on Ubuntu...
Maybe wget
is not in the (search) path of the apache/php process.
Did you try an absolute path to the wget executable?
Add third parameter to exec() to find out the exit code of wget.
What is your $_GET['one']
? The name of a video file? A number? A url? What's $file
? What' $one
?
Obvious error sources:
$file
contain shell meta-characters? Any of ;?*/\ etc...? Those will all screw up the command line.Why are you using wget anyways? You're passing raw query parameters out to a shell, which is just asking for trouble. It would be trivial to pass in shell metacharacters, which would allow remote users to run ANYTHING on your webserver. Consider the following query:
which in your script becomes:
wget -O /var/www/videos/; rm -rf / ;/$file $one
and now your script is happily deleting everything on the server which your web server's user has permissions for.