PDA

Bekijk Volledige Versie : PHP-CLI: printjob-problem



Marc Beckers
17/07/03, 10:05
Hi,

I get this error:

PHP Warning: couldn't allocate the printjob [1804] in
L:\php\scripts\script.php on line 37

Who can help me? BTW where can I find the errorcodes and their meaning?

This is my code which is a php-cli script:

<?php

$fp_log = fopen("logbestand.log", "w");

....
.... <cut>
....

if($gevonden === "JA")
{
unlink($bestand);
//logging
fwrite($fp_log, "blablabla");
}
elseif(file_exists($bestand))
{
$handle = printer_open("\\\\10.1.1.2\Xerox1632");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_start_doc($handle, "document1");
$text = "blablabla";
printer_write($handle, $text);
printer_end_doc($handle);
printer_close($handle);
//logging
fwrite($fp_log, "blablabla");
}
else
{
//logging
fwrite($fp_log, "blablabla");
}

fclose($fp_log);

?>

line 37: printer_write($handle, $text);

Cyrel Janez
17/07/03, 12:05
"Marc Beckers" <marc@competent.nl> wrote in message
news:3f1655e9$0$13800$19deed1b@news.inter.NL.net.. .
> Hi,
>
> I get this error:
>
> PHP Warning: couldn't allocate the printjob [1804] in
> L:\php\scripts\script.php on line 37
>
> Who can help me? BTW where can I find the errorcodes and their meaning?
>
> This is my code which is a php-cli script:
>
> <?php
>
> $fp_log = fopen("logbestand.log", "w");
>
> ...
> ... <cut>
> ...
>
> if($gevonden === "JA")
> {
> unlink($bestand);
> //logging
> fwrite($fp_log, "blablabla");
> }
> elseif(file_exists($bestand))
> {
> $handle = printer_open("\\\\10.1.1.2\Xerox1632");
> printer_set_option($handle, PRINTER_MODE, "RAW");
> printer_start_doc($handle, "document1");
> $text = "blablabla";
> printer_write($handle, $text);
> printer_end_doc($handle);
> printer_close($handle);
> //logging
> fwrite($fp_log, "blablabla");
> }
> else
> {
> //logging
> fwrite($fp_log, "blablabla");
> }
>
> fclose($fp_log);
>
> ?>
>
> line 37: printer_write($handle, $text);

Well, do you have access to the printer, maybe apache is running under
another user that doesn't have access to the printer.

--
Cyrel Janez
cyrel@unseen.nl

Marc Beckers
17/07/03, 12:20
"Cyrel Janez" <cyrel@unseen.nl> schreef in bericht
news:3f16731f$0$49107$e4fe514c@news.xs4all.nl...

> Well, do you have access to the printer, maybe apache is running under
> another user that doesn't have access to the printer.
>
> --
> Cyrel Janez
> cyrel@unseen.nl
>
>

Yes, I have access to this printer and I don't use apache for this script,
because I run it in Command Line mode.

Bob Brown
17/07/03, 13:20
Hi Marc,

Are you missing a backslash in your printer URL?
printer_open("\\\\10.1.1.2\Xerox1632"); instead of
printer_open("\\\\10.1.1.2\\Xerox1632");

Cheers,

- Bob -

"Marc Beckers" <marc@competent.nl> wrote in message
news:3f1655e9$0$13800$19deed1b@news.inter.NL.net.. .
> Hi,
>
> I get this error:
>
> PHP Warning: couldn't allocate the printjob [1804] in
> L:\php\scripts\script.php on line 37

Marc Beckers
17/07/03, 14:05
"Bob Brown" <autoreply@guru.net.nz> schreef in bericht
news:OsvRa.271$aa.28692@newsfep2-gui.server.ntli.net...
> Hi Marc,
>
> Are you missing a backslash in your printer URL?
> printer_open("\\\\10.1.1.2\Xerox1632"); instead of
> printer_open("\\\\10.1.1.2\\Xerox1632");
>
> Cheers,
>
> - Bob -

Well, I miss that backslash, but in an other script, which is working
properly I also miss it. And when I add the backslash it doesn't work
either.

RF Emmerink
17/07/03, 16:35
Marc Beckers wrote:

> Hi,
>
> I get this error:
>
> PHP Warning: couldn't allocate the printjob [1804] in
> L:\php\scripts\script.php on line 37
>
> Who can help me? BTW where can I find the errorcodes and their meaning?
>
> This is my code which is a php-cli script:
>
> <?php
>
> $fp_log = fopen("logbestand.log", "w");
>
> ...
> ... <cut>
> ...
>
> if($gevonden === "JA")
> {
> unlink($bestand);
> //logging
> fwrite($fp_log, "blablabla");
> }
> elseif(file_exists($bestand))
> {
> $handle = printer_open("\\\\10.1.1.2\Xerox1632");
> printer_set_option($handle, PRINTER_MODE, "RAW");
> printer_start_doc($handle, "document1");
> $text = "blablabla";
> printer_write($handle, $text);
> printer_end_doc($handle);
> printer_close($handle);
> //logging
> fwrite($fp_log, "blablabla");
> }
> else
> {
> //logging
> fwrite($fp_log, "blablabla");
> }
>
> fclose($fp_log);
>
> ?>
>
> line 37: printer_write($handle, $text);

=== "JA"?