> I'm writing a SYSV LP script in PHP so that I can have a
> print-to-database (MySQL) solution. First question: Am I wasting my
> time? Are there already canned solutions? (LPRng perhaps?)

I think you could just exec() it...

exec("/usr/bin/lp $blah", $output, $error);
while (list(,$line) = each($output)){
    echo $line, "<BR>\n";
}
if ($error){
    echo "OS Error $error.  Usually path/permissions, but with a printer
involved...<BR>\n";
}

Or maybe I'm not reading enough into the phrase print-to-database, and
you're doing something horribly more complicated than I think...

> Second question: How do I go about opening file descriptors by
> numeric referance? (LP calls script with file descriptors for passing back
> debug and status info).

You mean like this?

$printer = fopen("/dev/3", "r");

I dunno what number your OS assigns to the printer, but 3 probably isn't
it...

There's also PHP constants for stdin, stdout, and stderr, and there just
might be one for the printer, though I've never noticed it.

> Third question: How do I trap a signal (SIGTERM specifically) in a
> PHP script?

Maybe, maybe, maybe...

The socket() stuff will let you do that...

http://php.net/manual/en/ref.sockets.php

> Obviously, I have the latest PHP compiled as a CGI with native MySQL
> support. My OS environ is Solaris 7.

You may need to recompile with the socket stuff, which I think is optional.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to