php-windows Digest 8 May 2009 10:00:19 -0000 Issue 3619

Topics (messages 29317 through 29322):

Re: {** SPAM **} Re: [PHP-WIN] printing on IIS7
        29317 by: Paul Giesberts

Re: printing on IIS7
        29318 by: James Crow
        29319 by: Richard Quadling
        29320 by: Paul Giesberts
        29321 by: Paul Giesberts

Non blocking file i/o support for win32.
        29322 by: Richard Quadling

Administrivia:

To subscribe to the digest, e-mail:
        php-windows-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-windows-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-wind...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi Jacob,

Thanks for your quick reply. I have 19 networked barcode printers, which
I like to print to using the code that I have. Changing it would be a
bit of a job. Considering that this works on a box using IIS 6, I don't
want to give up on this yet.

Thanks,
Paul Giesberts
IT & QA Manager
Servicecare

-----Original Message-----
From: Jacob Kruger [mailto:jac...@iburst.co.za] 
Sent: 05 May 2009 10:37
To: Paul Giesberts
Subject: {** SPAM **} Re: [PHP-WIN] printing on IIS7

Why don't you just use javascript to print the content?

Think it's something like window.print(), but not 100% sure.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- 
From: "Paul Giesberts" <p.giesbe...@servicecare.uk.net>
To: <php-wind...@lists.php.net>
Sent: Tuesday, May 05, 2009 10:52 AM
Subject: [PHP-WIN] printing on IIS7


Hi,

I have migrated a php site from Linux to windows. The only remaining
problem 
seems to be printing, naturally I have had to change the code and that's

where the problems have started. I have the following very simple code:

<?php

$txt = "Hello World";
$handle = printer_open("DELL3115");
printer_write($handle, $txt);
printer_close($handle);
?>

When I run this from the command prompt using php -f ..... It works
fine, in 
other words it prints, when I run this script through the web browser
then I 
get this:

Fatal error: Out of memory (allocated 262144) (tried to allocate
4294967295 
bytes) in C:\inetpub\wwwroot\testprn.php on line 4

I have read this article: http://support.microsoft.com/?kbid=184291 and
many 
others, which all lead me to believe that it is an account / permission 
problem. On a side note: $handle = printer_open("non-existing-printer");

gives me a normal error in the sense of "can't find printer".

I run Windows 2008 64 bit, IIS7, php 5.2 32 bit ( I have enabled 32 bit
apps 
in IIS and the rest of the site works fine), using FastCGI.
Has anyone got any ideas?

Thanks,
Paul Giesberts
IT & QA Manager
-------------------------------------------------------------
Servicecare
Manchester Road
Oldham
OL9 7AA
-------------------------------------------------------------
DDI: ++44-161-6881985
Tel: ++44-161-6881999
Fax: ++44-161-6881998
email: p.giesbe...@servicecare.co.uk

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


__________ Information from ESET NOD32 Antivirus, version of virus
signature 
database 4052 (20090504) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4052 (20090504) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




--- End Message ---
--- Begin Message ---
Paul,

I had a smiliar problem once where I had changed the amount of memory from 16M to 256 (note the missing M). Check your memory setting in php.ini. 262144 seems like 256K. I think that may be the default minimum amount of memory for a script.

On my Linux systems there is a different php.ini for command line versus apache instances. I don't know if Windows does the same thing.

Cheers,
James

Paul Giesberts wrote:
Hi,
I have migrated a php site from Linux to windows. The only remaining problem seems to be printing, naturally I have had to change the code and that's where the problems have started. I have the following very simple code:
<?php
$txt = "Hello World";
$handle = printer_open("DELL3115");
printer_write($handle, $txt);
printer_close($handle);
?>

When I run this from the command prompt using php -f ..... It works fine, in 
other words it prints, when I run this script through the web browser then I 
get this:

Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295 
bytes) in C:\inetpub\wwwroot\testprn.php on line 4

I have read this article: http://support.microsoft.com/?kbid=184291 and many others, which all lead 
me to believe that it is an account / permission problem. On a side note:  $handle = 
printer_open("non-existing-printer"); gives me a normal error in the sense of "can't 
find printer".

I run Windows 2008 64 bit, IIS7, php 5.2 32 bit ( I have enabled 32 bit apps in 
IIS and the rest of the site works fine), using FastCGI.
Has anyone got any ideas?

Thanks, Paul Giesberts
IT & QA Manager
-------------------------------------------------------------
Servicecare
Manchester Road
Oldham
OL9 7AA
-------------------------------------------------------------
DDI: ++44-161-6881985
Tel: ++44-161-6881999
Fax: ++44-161-6881998
email: p.giesbe...@servicecare.co.uk


--- End Message ---
--- Begin Message ---
2009/5/5 Paul Giesberts <p.giesbe...@servicecare.uk.net>:
> Hi,
>
> I have migrated a php site from Linux to windows. The only remaining problem 
> seems to be printing, naturally I have had to change the code and that's 
> where the problems have started. I have the following very simple code:
>
> <?php
>
> $txt = "Hello World";
> $handle = printer_open("DELL3115");
> printer_write($handle, $txt);
> printer_close($handle);
> ?>
>
> When I run this from the command prompt using php -f ..... It works fine, in 
> other words it prints, when I run this script through the web browser then I 
> get this:
>
> Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295 
> bytes) in C:\inetpub\wwwroot\testprn.php on line 4
>
> I have read this article: http://support.microsoft.com/?kbid=184291 and many 
> others, which all lead me to believe that it is an account / permission 
> problem. On a side note:  $handle = printer_open("non-existing-printer"); 
> gives me a normal error in the sense of "can't find printer".
>
> I run Windows 2008 64 bit, IIS7, php 5.2 32 bit ( I have enabled 32 bit apps 
> in IIS and the rest of the site works fine), using FastCGI.
> Has anyone got any ideas?
>
> Thanks,
> Paul Giesberts
> IT & QA Manager
> -------------------------------------------------------------
> Servicecare
> Manchester Road
> Oldham
> OL9 7AA
> -------------------------------------------------------------
> DDI: ++44-161-6881985
> Tel: ++44-161-6881999
> Fax: ++44-161-6881998
> email: p.giesbe...@servicecare.co.uk
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Strangely enough, I've just had a very similar issue with another
application (Timeware needing to print a "Who Is In" report when the
fire alarm rings).

The issue we found was that the account being used to run the service
did not have access to the printer. In our case, Timeware didn't bomb
out, but nothing was printed.

As soon as we gave permissions to the printer for the Timeware
service, all was well.


Now with regards to IIS, I'm not too sure.

What I have half worked out ...

http://docs.php.net/manual/en/ini.core.php#ini.fastcgi.impersonate is
required to be set to 1.

The ApplicationPool that your site(s) run under needs to be set to
something which can print.



-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--- End Message ---
--- Begin Message ---
Hi Richard,

Many, many thanks, that has done the trick. ****BUT**** I had to turn it off. I 
have had to set fastcgi.impersonate=0 to fix it, which makes sense in a way 
because the user under which IIS runs has been given access to print, but the 
user browsing the site has not. I don't use any form of logging onto the site, 
so I would not know what user it was...

Thanks again,
Paul Giesberts
IT & QA Manager
Servicecare

-----Original Message-----
From: Richard Quadling [mailto:rquadl...@googlemail.com] 
Sent: 05 May 2009 13:23
To: Paul Giesberts
Cc: php-wind...@lists.php.net
Subject: Re: [PHP-WIN] printing on IIS7

2009/5/5 Paul Giesberts <p.giesbe...@servicecare.uk.net>:
> Hi,
>
> I have migrated a php site from Linux to windows. The only remaining problem 
> seems to be printing, naturally I have had to change the code and that's 
> where the problems have started. I have the following very simple code:
>
> <?php
>
> $txt = "Hello World";
> $handle = printer_open("DELL3115");
> printer_write($handle, $txt);
> printer_close($handle);
> ?>
>
> When I run this from the command prompt using php -f ..... It works fine, in 
> other words it prints, when I run this script through the web browser then I 
> get this:
>
> Fatal error: Out of memory (allocated 262144) (tried to allocate 
> 4294967295 bytes) in C:\inetpub\wwwroot\testprn.php on line 4
>
> I have read this article: http://support.microsoft.com/?kbid=184291 and many 
> others, which all lead me to believe that it is an account / permission 
> problem. On a side note:  $handle = printer_open("non-existing-printer"); 
> gives me a normal error in the sense of "can't find printer".
>
> I run Windows 2008 64 bit, IIS7, php 5.2 32 bit ( I have enabled 32 bit apps 
> in IIS and the rest of the site works fine), using FastCGI.
> Has anyone got any ideas?
>
> Thanks,
> Paul Giesberts
> IT & QA Manager
> -------------------------------------------------------------
> Servicecare
> Manchester Road
> Oldham
> OL9 7AA
> -------------------------------------------------------------
> DDI: ++44-161-6881985
> Tel: ++44-161-6881999
> Fax: ++44-161-6881998
> email: p.giesbe...@servicecare.co.uk
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
>
>

Strangely enough, I've just had a very similar issue with another application 
(Timeware needing to print a "Who Is In" report when the fire alarm rings).

The issue we found was that the account being used to run the service did not 
have access to the printer. In our case, Timeware didn't bomb out, but nothing 
was printed.

As soon as we gave permissions to the printer for the Timeware service, all was 
well.


Now with regards to IIS, I'm not too sure.

What I have half worked out ...

http://docs.php.net/manual/en/ini.core.php#ini.fastcgi.impersonate is required 
to be set to 1.

The ApplicationPool that your site(s) run under needs to be set to something 
which can print.



--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--- End Message ---
--- Begin Message ---
Hi James,

That did not work for me. Thanks for your quick reply though. The
solution for me was fastcgi.impersonate = 0. Thanks to Richard.

Regards,
Paul Giesberts
IT & QA Manager
Servicecare

-----Original Message-----
From: James Crow [mailto:ja...@ultratans.com] 
Sent: 05 May 2009 13:20
To: Paul Giesberts
Cc: php-wind...@lists.php.net
Subject: Re: [PHP-WIN] printing on IIS7

Paul,

  I had a smiliar problem once where I had changed the amount of memory
from 16M to 256 (note the missing M). Check your memory setting in
php.ini. 262144 seems like 256K. I think that may be the default minimum
amount of memory for a script.

  On my Linux systems there is a different php.ini for command line
versus apache instances. I don't know if Windows does the same thing.

Cheers,
James

Paul Giesberts wrote:
> Hi,
>  
> I have migrated a php site from Linux to windows. The only remaining
problem seems to be printing, naturally I have had to change the code
and that's where the problems have started. I have the following very
simple code: 
>
> <?php
>     
> $txt = "Hello World";
> $handle = printer_open("DELL3115");
> printer_write($handle, $txt);
> printer_close($handle);
> ?>
>
> When I run this from the command prompt using php -f ..... It works
fine, in other words it prints, when I run this script through the web
browser then I get this:
>
> Fatal error: Out of memory (allocated 262144) (tried to allocate 
> 4294967295 bytes) in C:\inetpub\wwwroot\testprn.php on line 4
>
> I have read this article: http://support.microsoft.com/?kbid=184291
and many others, which all lead me to believe that it is an account /
permission problem. On a side note:  $handle =
printer_open("non-existing-printer"); gives me a normal error in the
sense of "can't find printer".
>
> I run Windows 2008 64 bit, IIS7, php 5.2 32 bit ( I have enabled 32
bit apps in IIS and the rest of the site works fine), using FastCGI.
> Has anyone got any ideas?
>
> Thanks,
> Paul Giesberts
> IT & QA Manager
> -------------------------------------------------------------
> Servicecare
> Manchester Road
> Oldham
> OL9 7AA
> -------------------------------------------------------------
> DDI: ++44-161-6881985
> Tel: ++44-161-6881999
> Fax: ++44-161-6881998
> email: p.giesbe...@servicecare.co.uk
>
>   


--- End Message ---
--- Begin Message ---
Hi.

Can anyone with windows knowledge take a quick look at
http://bugs.php.net/bug.php?id=47918. I'm pretty sure this IS a bug.
I'm hoping you don't say it is a documentation bug and it is something
you can fix.

My requirement is to allow non-blocking file i/o.

With non-win32, it seems that the fcntl() function can accept
O_NONBLOCK. This does not seem to be present on win32.


The doc for fopen() does not mention 'n' as being available (probably
for this reason).


Regards,

Richard.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--- End Message ---

Reply via email to