[ale] simple PHP question on proc_open

Jerry Yu jjj863 at gmail.com
Mon Feb 12 11:00:40 EST 2007


Thanks, Jay. I tried with 'cwd' passed in. same error, still.
Here is the exact error I am getting:
$ php j.php
PHP Warning:  proc_open(): cannot seek on a pipe in /tmp/j.php on line 11
sh: /date: No such file or directory
got it

Same script, j.php runs w/o problem with PHP/4.3 on CentOS 4.

On 2/12/07, Jay Loden <jloden at toughguy.net> wrote:
>
> 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
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list