popen() opens a named pipe to a program - you can read and write to it
if the program you're piping to supports that kind of interactivity
(mostly you just read the output from the command). However, in this
case, I don't think you want either popen() or fopen() (certainly not
fopen() - that just opens a file and that's not at all what you want).
You can use a system call or just backticks around the call to useradd
(if it's on the same server as your web server). If it's not, you'll
have to use sockets and or xmlrpc or some other messaging service.
BUT...you probably know that useradd requires root privs. So you either
have your webserver running as root (a really really bad idea), or you
have it configured to allow suid programs or you have useradd as suid
root - also not really good ideas.
Maybe you want to take a look at a program called Webmin
(http://www.webmin.com/) that already does what you are talking about. I
haven't used it for several years, but as I remember, it was a pretty
On Mon, 2002-07-22 at 17:56, Peter wrote:
> i'm tring to run the useradd command (under Solaris) to add a user to the
> system so i don't have to continueously remote log in and also make it
> easier for myself to add users to the system(s).. maybe popen isn't the best
> option for this .. though i don't think fopen will be able to do what i need
> it to do.. maybe playing around with sockets would be better?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php