Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fatal error: Out of memory - How do I get out of this one?

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I have written a PHP script to print our custom forms. I am not having any problems out my development box but it gives me an error in the operation box.

The error reads
Code:
Fatal error: Out of memory (allocated 1048576) (tried to allocate 4294967295 bytes) in G:\wamp\[URL unfurl="true"]www\magno\releaseprint.php[/URL] on line 270

My development box is nothing more than a DELL laptop with 1GB of RAM. My operation box is a DELL PowerEdge 6850 with 32GB of RAM. What is the deal?

Both boxes are running same version of PHP 5.2.5. Dev box is running Apache 2.2.6 and operation box is running 2.2.8. Dev box is running XP Pro and operation is running W-2003 R2 64bit.

I have changed my php.ini
Code:
;memory_limit = 128M      ; Maximum amount of memory a script may consume (128MB)
memory_limit = 6144M      ; Maximum amount of memory a script may consume (128MB)

The error seems to be pointing to this line:
Code:
$handle = printer_open("\\\\printserv\KONICA_MIAMI");

Thank you all for your assistance!
 
This might not help at all but 4294967295 is the largest number you can get in 32 bits i.e. 2^32-1 which equates to 4GB the largest amount of memory you could allocate.
You have two essential difference one being the differrence in Apache versions and that the your hardware is 64 bit (which kind of makes my 32 bit statement above a bit odd !).
I would:
Reduce the 6144mb to 128mb (as per the comment)
try it
Remove the call to printer_open ()
try it
Catch your lap top up to Apache 2.2.8
try it
Be interested in your results

 
Never mind, I had not created the referenced printer. Funny that it should give me the error it did.

Regards,
 
i suspect it was because windows was just spooling the output to memory whilst it tried to locate the printer. with the printer created i guess php can offload it's own output to the system print spooler.
 
I can live with that. The printer did exist on the printer server and it was set as shared but I just had not added it to the Apache/PHP server.

ingresman, I did set the limit back to 128M ... Thanks!

 
don't you love windows? it will spool and waste 32GB of RAM. yay Microsoft!!!

Ben Boyd
Network Engineer/Programmer/Student
Windstream Communications
JNCIA, JNCIS, CCNP
 
I have the exact same problem. I am getting:
Code:
 Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295 bytes) in C:\[URL unfurl="true"]www\wwwroot\spooldb\printlabelbarebones.php[/URL] on line 2

The file in question only contains these three lines:
Code:
<?php
$p = printer_open('\\\\CFPC-LAB08\DYMOLabel PassivLab');
?>

You wrote that you "had not created the referenced printer" and that you "just had not added it to the Apache/PHP server".

How do you create the printer and add it the apache/php?
 
In my case, all printers are defined in a printer server. The web server is where I needed to define the target printer to solve my error.

So, I had printerA defined in my printer server box and I was attempting to print to it from my web server but, I had not defined it within the printer server thus getting the error.

Once I defined printerA in my web server, error was no more.

Hope this clears things up for you.

Regards,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top