proc_open

Hi,

My server has disabled exec() of PHP, but they still left proc_open() available for the task. The problem is, I don't know how to use proc_open()!

I just want to simulate exec() with proc_open(), so can someone write a little script such as exec_alternative() that works as exec() but uses proc_open() actually? Or at least shed some light how to use proc_open() like exec() :o

Thanks in advance!

http://ca.php.net/manual/en/function.proc-open.php

Geee. I've seen that ages ago. And it didn't help a bit.
I don't want any pipes for stdout, stdin, stderr, etc. I simply want to mimic exec(), I want something that should work exectly as exec(), but uses proc_open and proc_close(). I tried this, but it didn't seem to be working:

function exec_alternative($cmd)
{
   return proc_close(proc_exec($cmd, array(), $foo));
}

The problem is, proc_close returns exit code, while exec() returns last line of result.