[ale] simple PHP question on proc_open
Jay Loden
jloden at toughguy.net
Mon Feb 12 01:08:11 EST 2007
http://ca.php.net/manual/en/function.proc-open.php
The "cwd" parameter is probably what you're looking for here:
The initial working dir for the command. This must be an absolute
directory path, or NULL if you want to use the default value (the
working dir of the current PHP process)
Since you're not passing a cwd param, I'd guess that it's causing it to default to someplace you don't want it to.
Hope that helps,
-Jay
Jerry Yu wrote:
> hi, I installed a wordpress plugin. It did a proc_open for a command of
> /usr/bin/convert. It always complains about 'sh: /convert no such file
> or directory'.
> To test the proc_open call, I wrote this snippet and found proc_open()
> somehow stripps the leading path and replaces with '/'. Running this
> following snippet, it complains about no '/date', no matter I have
> /usr/bin/date' or 'date' in the proc_open call. This is on an
> up-to-date Fedora Core 6/i386 with some secure configuration done for PHP.
>
> Here is a snippet
> ============= j.php =================
> <?php
>
> $cmd = 'date';
>
> $descriptors = array(
> 0 => array("pipe", "r"),
> 1 => array("pipe", "w"),
> 2 => array("file", "php://stderr", "w")
> );
> $process = proc_open('date', $descriptors, $fd_set);
> if (is_resource($process)) {
> print "got it\n";
> } else { print "NO NO"; }
> proc_close ($process);
> ?>
> ============= j.php =================
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list