Hi,

I did some test on Windows7 as well as Windows Server 2008. I used 
fastcgi.impersonate=1 in both the cases. On Windows 7 everything is fine. From 
Windows Server 2008 I am getting below error:

Fatal error: Out of memory (allocated 524288) (tried to allocate 4294967295 
bytes) in C:\inetpub\wwwroot\phptest\print.php on line 2

The test file 'print.php' is a simple PHP file where I am making one call to 
printer_open.

So went and debugged the code. In the function printer_open implementation, we 
make call to OpenPrinter and later to DocumentProperties. For some reason (I 
haven't figured it yet), OpenPrinter call is success whereas DocumentProperties 
fails and returns a negative number. Now look at the code below:

if (OpenPrinter(resource->name, &resource->handle, NULL) != 0) {
 
                resource->pi2 = (PRINTER_INFO_2 
*)emalloc(sizeof(PRINTER_INFO_2));
 
                resource->pi2->pDevMode = (DEVMODE 
*)emalloc(DocumentProperties(NULL, NULL, resource->name, NULL, NULL, 0));
 
                if (DocumentProperties(NULL, resource->handle, resource->name, 
resource->pi2->pDevMode, NULL, DM_OUT_BUFFER) == IDOK) {

Above the code tries to use Zend allocator to allocate memory assuming 
DocumentProperties returned a valid value (here the actual size). However 
DocumentProperties returned a negative value meaning failure and I believe this 
value is treated as unsigned integer leading to a huge value and thus the above 
message.

Regarding why DocumentProperties fails, I am not very sure. And this happens on 
Win2k3 too. Look at the bug reported at 
http://pecl.php.net/bugs/bug.php?id=12293 long time back.

Keith, you can try accessing the printer under a normal account and which is 
not part of administrator group and see if this helps. Ensure that the normal 
user has permission to access the printer.

Thanks,
Don.


-----Original Message-----
From: Keith Davis [mailto:keithda...@pridedallas.com] 
Sent: Monday, February 22, 2010 6:14 AM
To: Pierre Joye; Robert
Cc: php-windows@lists.php.net
Subject: RE: [PHP-WIN] What about php 5.3 and printers or PHP_PRINTER.DLL ?

Well, I'm on Server 2003, and I still cannot print. It only works with 
impersonate turned off, and that is not a solution, as I need to connect to 
remote files. 



Keith Davis (214) 906-5183

-----Original Message-----
From: Pierre Joye [mailto:pierre....@gmail.com]
Sent: Monday, February 22, 2010 8:11 AM
To: Robert
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] What about php 5.3 and printers or PHP_PRINTER.DLL ?

hi,

It works just fine here, did you install the print server?

Cheers,

On Mon, Feb 22, 2010 at 3:03 PM, Robert <effe....@virgilio.it> wrote:
> About no chance to print on a shared printer from windows server 2008.
>
> Please note that for some unknown reason, it is either impossible to 
> mount a shared printer on windows server 2008. Maybe that errors and 
> issues printing from php are connected to this issue.
>
> The only chance we had found to print on a shared printer from windows

> 2008, is to mount the printer as local printer and as port, to give 
> the full tcp/ip path + the shared name for the shared printer.
>
> Hope this can help anybody that have the same issue.
>
> Kind regards
>
>
> ""Keith Davis"" <keithda...@pridedallas.com> ha scritto nel messaggio 
> news:b0baccaa54a7cc479fb67d9494fb018a8cc...@dc01.pridedallas.com...
> How is that user specified?
>
>
>
> Keith Davis (214) 906-5183
>
> -----Original Message-----
> From: Pierre Joye [mailto:pierre....@gmail.com]
> Sent: Friday, February 05, 2010 3:26 PM
> To: Keith Davis
> Cc: Robert; php-windows@lists.php.net
> Subject: Re: [PHP-WIN] What about php 5.3 and printers or 
> PHP_PRINTER.DLL ?
>
> On Fri, Feb 5, 2010 at 10:16 PM, Keith Davis 
> <keithda...@pridedallas.com> wrote:
>> I found a post that said to set fastcgi.impersonate = 0 to fix this 
>> problem. It did.
>>
>> Can someone clarify what that setting does?
>
> It allows a server to run php-cgi under a given user. But that should 
> not affect printer at all, except if the user does not have the 
> permission to use this printer.
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org
>
> This message (including any attachments) may contain confidential or 
> otherwise privileged information and is intended only for the
> individual(s) to which it is addressed. If you are not the named 
> addressee you should not disseminate, distribute or copy this e-mail.
> Please notify the sender immediately by e-mail if you have received 
> this e-mail by mistake and delete this e-mail from your system. E-mail

> transmission cannot be guaranteed to be secured or error-free as 
> information could be intercepted, corrupted, lost, destroyed, arrive 
> late or incomplete, or contain viruses. The sender therefore does not 
> accept liability for any errors or omissions in the contents of this
message or that arise as a result of e-mail transmission.
> If verification is required please request a hard-copy version from 
> the sender.
>
> www.pridedallas.com
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
>
>



--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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


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



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

Reply via email to