Re: [PHP] Out of Memory error
On Fri, 2007-08-24 at 01:21 +1000, Naz Gassiep wrote: I'm getting out of memory errors in my image handling script, I *think* its because I'm handling images that are too large to fit in memory, but I thought I'd check before just upping the setting to 32mb. It is currently set to 16mb and I am working with a 2048x1536 image. Is it possible that the image is what is causing the scrip to OOM? Very likely. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Out of Memory error
I've got a followup question to this. Whenever you're doing something that takes too much memory, having a file uploaded that's bigger than max upload size (actually, not sure if that applies but I think it does) or when your script is taking too long to execute it just dies with a very unfriendly error. Is there any way to catch these errors, stop the script in some other way just before it ends so we can provide some reasonable feedback to the user? On 23/08/07, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2007-08-24 at 01:21 +1000, Naz Gassiep wrote: I'm getting out of memory errors in my image handling script, I *think* its because I'm handling images that are too large to fit in memory, but I thought I'd check before just upping the setting to 32mb. It is currently set to 16mb and I am working with a 2048x1536 image. Is it possible that the image is what is causing the scrip to OOM? Very likely. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Interpotential.com Phone: +31615397471
Re: [PHP] Out of Memory error
Check the filesize before you attempt to load it. For uploads you can set maximum allowed uploads... can't remember if that is sufficient to catch the problem before it becomes a fatal error. Cheers, Rob. On Thu, 2007-08-23 at 17:35 +0200, Wouter van Vliet / Interpotential wrote: I've got a followup question to this. Whenever you're doing something that takes too much memory, having a file uploaded that's bigger than max upload size (actually, not sure if that applies but I think it does) or when your script is taking too long to execute it just dies with a very unfriendly error. Is there any way to catch these errors, stop the script in some other way just before it ends so we can provide some reasonable feedback to the user? On 23/08/07, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2007-08-24 at 01:21 +1000, Naz Gassiep wrote: I'm getting out of memory errors in my image handling script, I *think* its because I'm handling images that are too large to fit in memory, but I thought I'd check before just upping the setting to 32mb. It is currently set to 16mb and I am working with a 2048x1536 image. Is it possible that the image is what is causing the scrip to OOM? Very likely. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Out of memory error message
Guys, I've finally been able to solve this problem. See: http://franklin.oit.unc.edu/cgi-bin/lyris.pl?visit=freetdsid=178084891. The problem was being caused by http://www.freetds.org/faq.html#textdata. I solved it by modifying my SQL statement like so: $sql = SET TEXTSIZE 2048 SELECT Item.ItemNumber,Item.Description,Item.Type,Item.Comments,Inventory.Site,Inve ntory.Location,Inventory.ItemNumber,Inventory.SerialNumber,Inventory.Lot,Inv entory.OnHandQuantity FROM Item,Inventory WHERE (Item.ItemNumber='$ViewItemNumber' AND Item.ItemNumber=Inventory.ItemNumber); So far, it appears to be working! No problems yet that I can see! Just wanted to share! O From Now 'Till Then, \-Reginald Alex Mullin /\ 212-894-1690 -Original Message- From: Mullin, Reginald Sent: Monday, April 22, 2002 10:30 AM To: 'Chris Hewitt' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Out of memory error message Chris, Thanks for your feedback. Note: The ItemNumber is the Primary key for the Item table and the Foreign key for the Inventory table. Also, I'm only selecting a limited number of fields in the MSSQL query string. P.S.: If it were a PHP/MSSQL error, shouldn't the browser spit out an error message as well? O From Now 'Till Then, \-Reginald Alex Mullin /\ 212-894-1690 -Original Message- From: Chris Hewitt [SMTP:[EMAIL PROTECTED]] Sent: Saturday, April 20, 2002 7:10 AM To: Mullin, Reginald Subject:Re: [PHP] Out of memory error message Reginald, I assume both the Item and Inventory tables have an index on ItemNumber? If not then a full table scan would want lots of memory and time if the tables contain a large number of rows. Just a thought. HTH Chris Mullin, Reginald wrote: Hi Guys, Does anyone know what the following error message is and how I can go about solving it? ***ERROR MSG*** Out of memory during large request for 2147487744 bytes, total sbrk() is 1459608 bytes. This error message gets written to Apache's error logs every other time I execute my MSSQL query. The web browser then displays The page cannot be displayed error (404). ***SAMPLE MSSQL QUERY*** if ($ViewItemNumber){ $ViewItemNumber = urldecode($ViewItemNumber); $sql = SELECT Item.ItemNumber,Item.Description,Item.Type,Item.Comments,Inventory.Site,I nve ntory.Location,Inventory.ItemNumber,Inventory.SerialNumber,Inventory.Lot, Inv entory.OnHandQuantity FROM Item,Inventory WHERE (Item.ItemNumber='$ViewItemNumber' AND Item.ItemNumber=Inventory.ItemNumber); $query = mssql_query($sql) or die (THE SECOND (2) TABLE SELECTION FAILED.); $results = mssql_fetch_array($query); echo $results['ItemNumber']; } Note: I'm running LAMP locally (NY) and connecting remotely to a Windows 2000 box running MS SQL Server 2000 (UK) with the FreeTDS package. O From Now 'Till Then, \-Reginald Alex Mullin /\ 212-894-1690 ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the postmaster at [EMAIL PROTECTED] www.sothebys.com ** ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the postmaster at [EMAIL PROTECTED] www.sothebys.com ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Out of memory error message
Chris, Thanks for your feedback. Note: The ItemNumber is the Primary key for the Item table and the Foreign key for the Inventory table. Also, I'm only selecting a limited number of fields in the MSSQL query string. P.S.: If it were a PHP/MSSQL error, shouldn't the browser spit out an error message as well? O From Now 'Till Then, \-Reginald Alex Mullin /\ 212-894-1690 -Original Message- From: Chris Hewitt [SMTP:[EMAIL PROTECTED]] Sent: Saturday, April 20, 2002 7:10 AM To: Mullin, Reginald Subject: Re: [PHP] Out of memory error message Reginald, I assume both the Item and Inventory tables have an index on ItemNumber? If not then a full table scan would want lots of memory and time if the tables contain a large number of rows. Just a thought. HTH Chris Mullin, Reginald wrote: Hi Guys, Does anyone know what the following error message is and how I can go about solving it? ***ERROR MSG*** Out of memory during large request for 2147487744 bytes, total sbrk() is 1459608 bytes. This error message gets written to Apache's error logs every other time I execute my MSSQL query. The web browser then displays The page cannot be displayed error (404). ***SAMPLE MSSQL QUERY*** if ($ViewItemNumber){ $ViewItemNumber = urldecode($ViewItemNumber); $sql = SELECT Item.ItemNumber,Item.Description,Item.Type,Item.Comments,Inventory.Site,I nve ntory.Location,Inventory.ItemNumber,Inventory.SerialNumber,Inventory.Lot, Inv entory.OnHandQuantity FROM Item,Inventory WHERE (Item.ItemNumber='$ViewItemNumber' AND Item.ItemNumber=Inventory.ItemNumber); $query = mssql_query($sql) or die (THE SECOND (2) TABLE SELECTION FAILED.); $results = mssql_fetch_array($query); echo $results['ItemNumber']; } Note: I'm running LAMP locally (NY) and connecting remotely to a Windows 2000 box running MS SQL Server 2000 (UK) with the FreeTDS package. O From Now 'Till Then, \-Reginald Alex Mullin /\ 212-894-1690 ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the postmaster at [EMAIL PROTECTED] www.sothebys.com ** ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the postmaster at [EMAIL PROTECTED] www.sothebys.com ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php