RE: What about php 5.3 and printers or PHP_PRINTER.DLL ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I already mentioned the reason of failure. It is strange that OpenPrinter function is passing but DocumentProperties is failing. Ideally once OpenPrinter passes, everything should go through. And the worst thing is that this is an abandoned package. I don't see any maintainer for it. Why don't use something else like FPDF or something else which is generally supported?

Thanks,
Don.

-----Original Message-----
From: Keith Davis [mailto:keithdavis@xxxxxxxxxxxxxxx] 
Sent: Tuesday, February 23, 2010 5:52 AM
To: Venkat Raman Don; Pierre Joye; Robert
Cc: php-windows@xxxxxxxxxxxxx
Subject: RE:  What about php 5.3 and printers or PHP_PRINTER.DLL ?

Nope. I have an account called Test. It is not an Administrator account
(local or domain) and it can print to \\server05\Auth, but it fails here
too.



Keith Davis (214) 906-5183

-----Original Message-----
From: Venkat Raman Don [mailto:Don.Raman@xxxxxxxxxxxxx] 
Sent: Monday, February 22, 2010 4:30 PM
To: Keith Davis; Pierre Joye; Robert
Cc: php-windows@xxxxxxxxxxxxx
Subject: RE:  What about php 5.3 and printers or
PHP_PRINTER.DLL ?

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:keithdavis@xxxxxxxxxxxxxxx]
Sent: Monday, February 22, 2010 6:14 AM
To: Pierre Joye; Robert
Cc: php-windows@xxxxxxxxxxxxx
Subject: RE:  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.php@xxxxxxxxx]
Sent: Monday, February 22, 2010 8:11 AM
To: Robert
Cc: php-windows@xxxxxxxxxxxxx
Subject: Re:  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.stm@xxxxxxxxxxx> 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"" <keithdavis@xxxxxxxxxxxxxxx> ha scritto nel messaggio 
> news:B0BACCAA54A7CC479FB67D9494FB018A8CC927@xxxxxxxxxxxxxxxxxxxxxxx
> How is that user specified?
>
>
>
> Keith Davis (214) 906-5183
>
> -----Original Message-----
> From: Pierre Joye [mailto:pierre.php@xxxxxxxxx]
> Sent: Friday, February 05, 2010 3:26 PM
> To: Keith Davis
> Cc: Robert; php-windows@xxxxxxxxxxxxx
> Subject: Re:  What about php 5.3 and printers or 
> PHP_PRINTER.DLL ?
>
> On Fri, Feb 5, 2010 at 10:16 PM, Keith Davis 
> <keithdavis@xxxxxxxxxxxxxxx> 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



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux