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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fatal error: allowed memory size of 41943040 bytes exhausted (tried to

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hello guys

If this is not a php question please advise me and I'll post somewhere else.

I recently installed phpmyadmin on our server and have a 20mb limit on files uploaded. This works fine to a point but when I try to upload a zipped file containing a csv file with 280000 lines (file size approx 9mb) I get an error:
Code:
fatal error: allowed memory size of 41943040 bytes exhausted (tried to allocate
There is no clear explanation with a Google search that I can understand.

I have access to all php files and can edit any if required.

Thank you
 
The explanation is clear. You are using all allowed memory. Increase the script allowed memory and restart the webserver. Or manipulate the zip file using exec calls. Or reduce the filesize or you might be able to do something by optimising your code.
 
Jpadie

thank you for the response.

How do I increase the memory allowed?
How do I manipulate the zip file using exec calls?
How do I optimise my code?

I am aware of the memory problem but I'm looking for a way to resolve it using a method or methods that I can understand.

Thanks


 
iteratively:

1. open php.ini and change the relevant directive. close it and restart the webserver. most likely the relevant directive is memory_limit and you should set it to 128M or maybe 256M (
2. something like this perhaps

Code:
$cmd = 'unzip -d ' . $path/to/zip/file.zip ;
exec ($cmd);

3. impossible to tell since you have not posted your code. bluntly, optimising code for memory management involves being careful about what gets read in to dynamic variables. change to writing line by line rather than per file etc.
 

Hi jpadie

What you have posted makes sense to me now.

I'll work on it and many thanks for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top