From: Stut on
Moore, Joshua wrote:
> No, im not using IIS =\ since im using Uniform Server I thought it would just
> use the same user that im logged in with running the service...

In that case I really can't help you since I've never heard of Uniform
Server.

Check the task manager and see what user it's running as. Whatever the
outcome I would say it's worth asking on a mailing list for that
particular server as well as here.

-Stut

> -----Original Message-----
> From: Stut [mailto:stuttle(a)gmail.com]
> Sent: Tuesday, May 29, 2007 2:05 PM
> To: Moore, Joshua
> Cc: php-windows(a)lists.php.net
> Subject: Re: [PHP-WIN] Printing via webapp
>
> Moore, Joshua wrote:
>> But under printer permissions its set to allow "everyone" to print.
>
> I don't know enough about Windows security to be much more help here,
> but I will say that if you're using IIS then the IUSR_machine user is
> 'special' and lacks a lot of the permissions that normal users have.
>
> Probably worth checking the result of printer_open - I'm guessing it's
> failing. You may also want to search the archives of this list as
> problems with printing come up fairly frequently.
>
> -Stut
>
>> -----Original Message-----
>> From: Stut [mailto:stuttle(a)gmail.com]
>> Sent: Tuesday, May 29, 2007 1:56 PM
>> To: Moore, Joshua
>> Cc: php-windows(a)lists.php.net
>> Subject: Re: [PHP-WIN] Printing via webapp
>>
>> Moore, Joshua wrote:
>>> Im having a few odd issues with printing and im hoping someone can help
> me.
>>> I can manually print to my barcode printer just fine (FILE<PRINT in a web
>>> browser). However if I try and print using PHP printer_write it doesn't
>>> print. Yes I have the php_printer.dll installed. My code:
>>>
>>> <?
>>> function getPrinter($SharedPrinterName) {
>>>
>>> global $REMOTE_ADDR;
>>>
>>> $host = getHostByAddr($REMOTE_ADDR);
>>>
>>> return "\\\\".$host."\\".$SharedPrinterName;
>>>
>>> }
>>>
>>> $handle = printer_open(getPrinter("ZebraZ4M"));
>>>
>>> printer_write($handle, "Text to print");
>>>
>>> printer_close($handle);
>>>
>>> ?>
>>>
>>> Gives the following error:
>>>
>>> Warning: printer_write() [function.printer-write
>>> <http://localhost/test/function.printer-write> ]: couldn't allocate the
>>> printerjob [1804] in W:\www\test\print.php on line 19
>>>
>>> And it doesn't print. I'm quite lost. Also, im using uniform server on
>>> windows XP and I do have my printer drivers install since I can print
>>> manually just fine...
>> It's almost certainly permissions-related. The user that your web server
>> runs as needs to have access to the printer.
>>
>> -Stut
>
From: Niel Archer on


> In that case I really can't help you since I've never heard of Uniform
> Server.

Uniform Server is a WAMP package. It was mentioned on this or the Db
list recently. Presumably then, Apache's permissions would be the
determining factor?

http://www.uniformserver.com/



Niel
From: Juan Ignacio Borda on
I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.
>
>> In that case I really can't help you since I've never heard of Uniform
>> Server.
>>
>
> Uniform Server is a WAMP package. It was mentioned on this or the Db
> list recently. Presumably then, Apache's permissions would be the
> determining factor?
>
> http://www.uniformserver.com/
>
>
>
> Niel
>
>
From: "Moore, Joshua" on
Yes it is a printer on LPT1. Well IF it is indeed a permissions problem then
I would guess its permissions on the barcode printer im trying to print too
because if I change the printer to my LaserJet it prints fine with no
warnings or errors.

However looked on the PHP manual comments it said this:

"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "

so my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>

The warning goes away but it doesn't print!! :( Nothing in the apache2 error
logs :(

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows(a)lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.
>
>> In that case I really can't help you since I've never heard of Uniform
>> Server.
>>
>
> Uniform Server is a WAMP package. It was mentioned on this or the Db
> list recently. Presumably then, Apache's permissions would be the
> determining factor?
>
> http://www.uniformserver.com/
>
>
>
> Niel
>
>
From: "Moore, Joshua" on
One more thing,

When I run my php script I see that the printjob gets put into the windows
printing list for that printer however it pops up, says its spolling under
the status then disappears and nothing prints...

:(

-----Original Message-----
From: Moore, Joshua [mailto:Joshua.Moore(a)tusd1.org]
Sent: Wednesday, May 30, 2007 6:24 AM
To: Juan Ignacio Borda; php-windows(a)lists.php.net
Subject: RE: [PHP-WIN] Printing via webapp

Yes it is a printer on LPT1. Well IF it is indeed a permissions problem then
I would guess its permissions on the barcode printer im trying to print too
because if I change the printer to my LaserJet it prints fine with no
warnings or errors.

However looked on the PHP manual comments it said this:

"If you need printer_write you must to change the datatype:
printer_set_option($handle, PRINTER_MODE, "RAW"); "

so my code:

<?
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("ZebraZ4M"));
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "Text to print");
printer_close($handle);
?>

The warning goes away but it doesn't print!! :( Nothing in the apache2 error
logs :(

Im stuck, any ideas?

-----Original Message-----
From: Juan Ignacio Borda [mailto:webmaster(a)baexporta.gba.gov.ar]
Sent: Wednesday, May 30, 2007 5:44 AM
To: php-windows(a)lists.php.net
Subject: Re: [PHP-WIN] Printing via webapp

I'm intrested on this function too, did you tried to print locally let's
say to LPT1 ? this will jelp you debug if it's the case that you can't
print or acces a shared resource.
>
>> In that case I really can't help you since I've never heard of Uniform
>> Server.
>>
>
> Uniform Server is a WAMP package. It was mentioned on this or the Db
> list recently. Presumably then, Apache's permissions would be the
> determining factor?
>
> http://www.uniformserver.com/
>
>
>
> Niel
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php