Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
edited by

How do I run the Linux command from the PHP script? I'm running Linux Debian and PHP5. I want to be able to issue the 'wget' command to the console.

I am looking for something like this:

phpFunction ("wget /folder");

echo "done";

I should also be able to echo my output of that function?

1 Answer

0 votes
by (36.8k points)

Use the exec to run several commands. Be careful not to exec any of the user input though, as it can critically compromise your server.

Most of them shared servers block off the exec function that might be the reason you're not able to use it.

Finally, as a shorthand, you can wrap your command you want to exec in backticks.

Want to be a Linux expert? Come and join this Linux course

Do check out the video below

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...