Johan Carlsson
Johan Carlsson

Reputation: 803

How do I run a process from PHP

I need to start a Unix process by calling a PHP-page through the web. I also need to send some arguments to the PHP-page that gets substituted into the command in a save way.

Upvotes: 1

Views: 2035

Answers (2)

bucabay
bucabay

Reputation: 5295

If you need more control over IO, then take a look at: http://php.net/manual/en/function.popen.php http://php.net/manual/en/function.proc-open.php

Upvotes: 0

Greg
Greg

Reputation: 321618

Take a look at exec() and escapeshellarg():

exec('command -param=' . escapeshellarg($_GET['argument']));

Upvotes: 7

Related Questions