473,326 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

proc_open, write error to var instead file??

Howdy,

For a script I need the exact output of the apache htdbm.exe to a var so
I can extract all users from a database. Now I found out that this can
be done with Proc_open. I got this script from the php website which
looks something like copied below...

Since I can not find very good documentation on this function my
question is: I suppose that the problem is with this
2 => array("file", "error-output.txt", "w") // stderr is a file to

How do I need to edit this to make the 'error' be written in a var
instead of a file..? I tried a few thing but did not succeed.

Thanks in advance, Maarten
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read
from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("file", "error-output.txt", "w") // stderr is a file to
write to
);
$process = proc_open("E:\\passwords\\htdbm.exe -l
$password_dir\\.htpasswd", $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt

fwrite($pipes[0], "");
fclose($pipes[0]);

while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
Jul 17 '05 #1
0 1647

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Christian Hammers | last post by:
Hello I would like to call a unix shellscript from within a PHP script and - write data to its STDIN - read data from its STDOUT *and* STDERR - get its exit code afterwards proc_open seems...
4
by: FLEB | last post by:
I like PHP for its excellent inline integration into standard HTML files, but I like Perl for its quick-moving syntax and simpler data-processing. To resolve this deep-seated inner turmoil (oh, the...
0
by: FrenKy | last post by:
Hi *. I get this error when trying to run proc_open() function: "Fatal error: Call to undefined function: proc_open() in /home/frantic/public_html/a/phpshell.pup on line 140" Does anybody...
2
by: razorfold | last post by:
Hi, I've been trying to run gpg through proc_open() and have failed all weekend. I keep getting this error from stderr: "/usr/bin/gpg: error while loading shared libraries: cannot restore...
4
by: darrin.skinner | last post by:
Hi all, How can I open a file/pipe to something other than STDOUT/STDERR? I.e. I want to write to file descriptor # 3. fopen("php://std3"... does not work. fopen("/dev/ttyS3"... does not...
2
by: kimonp | last post by:
I am running on windows XP with a fresh install of wamp5 (1.7.2) and mediawiki. I am trying to call a perl function from within php using proc_open. The perl script is being executed and...
5
by: sakismat | last post by:
please help how can I get stderr from processes ($proc) in my screen without waiting the other processes to end #!/usr/bin/php <?php $con = mysql_connect("localhost", "user"); if (!$con)
6
by: xhe | last post by:
I am using ffmpeg to convert video, this is a sample script: $str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/ cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar...
1
by: YasirHussain | last post by:
hi! i want to execute a python script from php through proc_open() function of php.. i read a fine tutorial at ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.