On Sun, 2002-10-20 at 09:34, Wez Furlong wrote: Thanks for the fast reply Wez,
> There's not much we can tell you about this unless you post the > rest of the lines of that function. See below for the code > > Perhaps you did not include <php.h> ? Yep thats there, I used exec_skel to create the basic module. > > Note: always prefer this: > > read(fd, buf, sizeof(buf)); > > to this: > > read(fd, buf, 1024); Thanks, done that. OK, what I'm trying to achieve is basically wrapping pipe, read and write so in a php script I can create 2 pipes, fork the process using pcntl_fork() and have 2 way non blocking communication with more control than proc_open() I have so far written this function that creates the pipe and returns an array of the pipes descriptors: PHP_FUNCTION(pipe) { pipe_r_le_struct *st_pipe_r; pipe_w_le_struct *st_pipe_w; zval *read; zval *write; int pipe_fd[2]; if(pipe(pipe_fd) <0){ php_error(E_ERROR, "Could not create pipe"); } st_pipe_r=emalloc(sizeof(pipe_r_le_struct)); st_pipe_w=emalloc(sizeof(pipe_w_le_struct)); st_pipe_r->fd=pipe_fd[0]; st_pipe_w->fd=pipe_fd[1]; MAKE_STD_ZVAL(read); MAKE_STD_ZVAL(write); ZEND_REGISTER_RESOURCE(read, st_pipe_r, le_pipe_r) ZEND_REGISTER_RESOURCE(write, st_pipe_w, le_pipe_w) array_init(return_value); add_assoc_resource(return_value, "read", Z_RESVAL_P(read)); add_assoc_resource(return_value, "write", Z_RESVAL_P(write)); } This function appears to work as expected and now I'm trying to write functions that will read and write from the pipe. So far I have this, it isn't finished as you will see. PHP_FUNCTION(pipe_read) { pipe_r_le_struct *st_pipe_r; zval *read; zval * res; char buf[1024]; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { return; } ZEND_FETCH_RESOURCE(st_pipe_r, pipe_r_le_struct *, &res, -1, "pipe_r", le_pipe_r); if(!st_pipe_r) RETURN_FALSE; read(fd, buf, sizeof(buf)); } I was just testing that it still compiles and it fails on the read(fd, buf, sizeof(buf)); line. with the error called object is not a function As I mentioned if I move that line into a c function it compiles fine. Thanks Tony -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php