Console Work

From: Date: Wed, 15 Aug 2001 16:04:23 +0000
Subject: Console Work
Groups: php.dev 
Request: Send a blank email to php-dev+get-63292@lists.php.net to get a copy of this message
Hi there, I'm new to the list (only subscribed 2 mins ago!). I have subscribed a) to say bloody well done on a great language! and b) I am trying to find information on a few things related to console php (php -q)... First off, I wrote a small addition to ext/standard/exec.c that adds a fork () function. I haven't been testing it much yet (I've started to write a web server in it to see how well it works), but was wondering, is there a reason why the official PHP 4 currently lacks fork functionality? Obviously this wouldn't work very well in a web server module environment, but compiled as a CGI (for shell script style use), it is very handy. PHP seems pretty complete as far as console work goes, I have a 'standard' read ($prompt) function I can use that will determine the current TTY, open it, and get a line from the user. Readline is also extremely useful. My problem is with beutified output however. The day I untar php-x.xx.tar.gz and see ext/ncurses/php_ncurses.c flying past my terminal is a day I will be very preoccupied with code hacking into the early hours! My last 'feature request' is that of either a select () ability (I see 4.0.6 has a function called select in ext/standard/file.c (and ext/sockets/???.c) but I have not played with it), or another ability to read from files / fifos / character devices in a non-blocking way. Particularly, /dev/modem work is to my knowledge impossible at present. To round up, an ncurses module would be nice, a select function like that in C would be sex (!), a fork function (like that in C..). Thanks for your time taken reading the e-mail, and thanks for a bloody brilliant language (I have used it for web work too). If PHP had the above functionality, I can't see much left that stops it from being a rather complete and feature-packed general shell scripting language! (doh! signal handling would be nice too!) Cherio, -dw PS> Another thing I noticed, I wrote a diary.php script that allows me 'ninja speed' access to an OpenSSL'd diary in a very secure way. The code behind it is relatively tight, yet when I run it strace'd, I notice that there are a good 50 or so getuid ()'s before the EDITOR is exec'd. The speed at which the program runs is fine, but I was just wondering if it might indicate an underlying problem, or is that just the nature of interpreted languages (not very optimal)! On request, I'll make diary.php available, I intend sticking it on a public site soon anyway. ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie

« previous php.dev (#63292) next »