473,549 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allowed memory size of 16777216 bytes exhausted

I'm filling a really large array. Is there a way to get by
this error message without editing the php.ini? The array
needs to get built once, then looped through to fill a data-
base, and it will get alot bigger than 1.5MB, I'm going to
guess maybe at least 100MB.

<snip>

[12-Sep-2007 11:41:53] PHP Fatal error: Allowed memory size
of 16777216 bytes exhausted (tried to allocate 10 bytes) in...
.... on line 23687

</snip>

The other thing I was thinking of involves using a function
that gets supplied an index and returns only 20 or 50 items
at a time.

Thanks for any comments/suggestions.

--
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/
Sep 12 '07 #1
7 26611
On Wed, 12 Sep 2007 17:57:57 +0200, Jim Carlock <an*******@127. 0.0.1>
wrote:
I'm filling a really large array. Is there a way to get by
this error message without editing the php.ini? The array
needs to get built once, then looped through to fill a data-
base, and it will get alot bigger than 1.5MB, I'm going to
guess maybe at least 100MB.

<snip>

[12-Sep-2007 11:41:53] PHP Fatal error: Allowed memory size
of 16777216 bytes exhausted (tried to allocate 10 bytes) in...
... on line 23687

</snip>
http://www.php.net/manual/en/ini.cor...i.memory-limit

So, normally this would be perfectly changable in the script itself, in a
..htaccess or httpd.conf (for Apache), etc.
The other thing I was thinking of involves using a function
that gets supplied an index and returns only 20 or 50 items
at a time.
I'd look into possible solutions not even building your array, but a
straight insert (or update!) into the database. It depends on the actual
code/purpose though.

--
Rik Wasmus
Sep 12 '07 #2
"Rik Wasmus" wrote...
: http://www.php.net/manual/en/ini.cor...i.memory-limit

: So, normally this would be perfectly changable in the script itself,
: in a .htaccess or httpd.conf (for Apache), etc.

Thanks, Rik.

It took me a little while to find the appropriate function to set
the value. So to help others out, here's the function name and
use to help others reading along.

ini_set("memory _limit", "256M");

--
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/
Sep 12 '07 #3
"Jim Carlock" <an*******@127. 0.0.1wrote in news:46e834e6$0 $11048
$4*******@roadr unner.com:
"Rik Wasmus" wrote...
: http://www.php.net/manual/en/ini.cor...i.memory-limit

: So, normally this would be perfectly changable in the script itself,
: in a .htaccess or httpd.conf (for Apache), etc.

Thanks, Rik.

It took me a little while to find the appropriate function to set
the value. So to help others out, here's the function name and
use to help others reading along.

ini_set("memory _limit", "256M");
Interesting to see 'memory_limit' as a changeable setting via ini_set();

So, if a webhost set the PHP memory limit to 24M, and I know they have 2GB
on the machine, is it being suggested that I can override the limit set in
php.ini with a simple ini_set directive? This seems to put quite a lot of
'power' into the hands of PHP scripters?

Sep 12 '07 #4
Good Man wrote:
It took me a little while to find the appropriate function to set
the value. So to help others out, here's the function name and
use to help others reading along.

ini_set("memory _limit", "256M");

Interesting to see 'memory_limit' as a changeable setting via ini_set();

So, if a webhost set the PHP memory limit to 24M, and I know they have 2GB
on the machine, is it being suggested that I can override the limit set in
php.ini with a simple ini_set directive? This seems to put quite a lot of
'power' into the hands of PHP scripters?
Of course it is possible to prevent the value from being changed. If
settings were set with php_admin_value or php_admin_flag they can not be
changed.

And any descent host should know this.

Bye!
Sep 12 '07 #5
Do you need to build the array? Are you building this array from a
file? If so why not format the file and do a LOAD FILE query or better
yet use PhpMyAdmin to upload your file. Not sure if you need to make
the array then upload from the array.

Any possibility we can see some of your code?

Sep 13 '07 #6
"Jeff Johns" wrote...
: Do you need to build the array? Are you building this array
: from a file? If so why not format the file and do a LOAD FILE
: query or better yet use PhpMyAdmin to upload your file. Not
: sure if you need to make the array then upload from the array.
:
: Any possibility we can see some of your code?

Well, it's easy to convert to a .csv format, but I don't mess
with PhpMyAdmin. I took a look at that once a while back but I
end up seeing too many hacks against it, which creates a rather
insecure feeling.

The array is easy enough to convert to a regular CSV file and
other database formats from that. No I don't need to build the
array. That's just the way it started out.

Thanks for asking. I won't have any code to show for awhile.
I'm just creating an array which will create a database. I
suppose I can get to know the file (line) reading functions of
PHP as another way to get this done, but that's not my interest
right at the moment. I'm playing around with big arrays.

I'm curious to others suggestions. I think I'll end up using
SQLite IF I get done with this.

// over 6000 API definitions...

// index, Win32APIFunctio nName, ParameterList, ParameterListDe sc, ReturnValue, ReturnValueDesc Success, ReturnValueDesc Failure,
Purpose_URI, Purpose_desc

return(array(
array(0, "AbortDoc", "(hdc:DWORD )", "plist_desc ", "eSuccess:DWORD ", "32-bit", "Upon success, the return value is greater than zero
(0).", "Upon failure, the return value is SP_ERROR.", "http://msdn2.microsoft .com/en-us/library/ms535758.aspx", "<p>AbortDo c() stops
the current print job and erases everything drawn since the last call to StartDoc().</p>\n<p><b>Windo ws NT/2000/XP:</bCall
GetLastError() for extra error information.</p>"),
--
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/
Sep 13 '07 #7
Jim Carlock wrote:
"Jeff Johns" wrote...
: Do you need to build the array? Are you building this array
: from a file? If so why not format the file and do a LOAD FILE
: query or better yet use PhpMyAdmin to upload your file. Not
: sure if you need to make the array then upload from the array.
:
: Any possibility we can see some of your code?

Well, it's easy to convert to a .csv format, but I don't mess
with PhpMyAdmin. I took a look at that once a while back but I
end up seeing too many hacks against it, which creates a rather
insecure feeling.
I have PHPMyAdmin on several sites and never have a problem. They're
just in password protected directories so no one can get to them.

As for the hacks - just keep it updated, like everything else.

Or, you can continue to make things difficult for yourself. Your choice.

Or, are you confusing PHPMyAdmin (a web-based tool) with MySQL (a
database)? Again, I've had zero problems with MySQL on the systems I
have. But I have security in place, also.
The array is easy enough to convert to a regular CSV file and
other database formats from that. No I don't need to build the
array. That's just the way it started out.

Thanks for asking. I won't have any code to show for awhile.
I'm just creating an array which will create a database. I
suppose I can get to know the file (line) reading functions of
PHP as another way to get this done, but that's not my interest
right at the moment. I'm playing around with big arrays.
Generally a sign of a poor implementation. Use a database.
I'm curious to others suggestions. I think I'll end up using
SQLite IF I get done with this.
I'd highly recommend MySQL or PostgreSQL over SQLite. Much more robust.

// over 6000 API definitions...

// index, Win32APIFunctio nName, ParameterList, ParameterListDe sc, ReturnValue, ReturnValueDesc Success, ReturnValueDesc Failure,
Purpose_URI, Purpose_desc

return(array(
array(0, "AbortDoc", "(hdc:DWORD )", "plist_desc ", "eSuccess:DWORD ", "32-bit", "Upon success, the return value is greater than zero
(0).", "Upon failure, the return value is SP_ERROR.", "http://msdn2.microsoft .com/en-us/library/ms535758.aspx", "<p>AbortDo c() stops
the current print job and erases everything drawn since the last call to StartDoc().</p>\n<p><b>Windo ws NT/2000/XP:</bCall
GetLastError() for extra error information.</p>"),

You definitely need a database.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Sep 13 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12347
by: Paul | last post by:
Hi, I'm using TikiWiki and was using its file upload feature, trying to upload a 2MB file. I get this error: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1677706 bytes) in /var/html/www/tiki/lib/filegals/filegallib.php on line 30 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
2
4677
by: Phil Powell | last post by:
Actually the client is saying it sometimes happens and sometimes doesn't happen, and when they refresh their screen it clears itself (I assume the memory clears). Here is line 1135: $result = mysql_query($this->query, $this->dbcnx) or die(@include("$DOCUMENT_ROOT${devpath}errors/query_error.php")); It is found here in this class method:
0
711
by: Joe | last post by:
Hi, Now I am using Red Hat Linux 8.0 + squirrelmail as mail server. One day, I got the following warning: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes) in /usr/share/squirrelmail/functions/imap_messages.php on line 325
3
6697
by: f.amann | last post by:
hi there! i save images in a mysql db and i wrote a script called getimage.php to display them. in my getimage.php i want to resize my images to display them as thumbnails but there always occurs the following error: <b>Fatal error</b>: Allowed memory size of 188743680 bytes exhausted (tried to allocate 240 bytes) in...
15
2783
by: DV | last post by:
I have a StringBuilder that has a string with 12,000,000 characters. When I do a ToString(), I expect to have ~25,000,000 bytes worth of memory, yet, I end up with ~43,000,000 bytes. That's almost double the size. The string returned from ToString() is actually of size StringBuilder.Capacity, NOT StringBuilder.Length. It may have a...
0
2284
by: prabhjeet | last post by:
I have DB2 v9 trial version installed on Windows 2003 Server with 1GB RAM. I am able to connect remotely through an ODBC data source to the database, but when I try to connect to that data source using my application, I get the following error in db2diag.log: 2007-02-20-10.41.37.812000+330 E1562H677 LEVEL: Warning (OS) PID : 3720 TID : 2000...
1
2962
by: Kimmo Laine | last post by:
Hi! We've encountered a strange problem concerning memory usage. In the previous install the maximum memory amount per page was limited to 8 MB and it was never reached. Now, after upgrading both hardware and software, running the same scripts that used to be fine with 8 MB hit the roof all the time. The maximum memory allocation was set to...
3
3008
by: spereira | last post by:
I am running XAMPP for Mac OS X 0.6.1 ! And since it did not have PDF libarires I downloaded ezpdf from the url:http://sourceforge.net/project/showfiles.php?group_id=45168&package_id=37830&release_id=147645 unzipped into a folder pdf_test And tried to run from the local http://localhost/pdf_test/readme.php gets the error Fatal error:...
5
24624
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS (I am new to Windows so not sure). We are currently bouncing the instance to overcome this error. This generally happen at the end of business day...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.