Post by Sakz » Thu Jul 12, 2012 5:40 am

Hi there

Whenever I try to re-import my xls file after editing it using the Export/Import tool in OpenCart 1.5.2.1 I get the following error:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 105 bytes) in /home/*username*/public_html/system/PHPExcel/Classes/PHPExcel/Worksheet.php on line 961

My hosting company has increased the memory settings in my php.ini file too a point where it should very easily be able to upload this file, however I continually get this error. Any help would be greatly appreciated!

Newbie

Posts

Joined
Thu Jul 12, 2012 5:37 am

Post by rph » Thu Jul 12, 2012 8:50 am

It's not the file size but the operations carried out on it. I'd guess you're trying to import a large amount of products if you're exhausting 512MB of RAM.

What I'd suggest is setting up a local server environment on your PC (WAMP, XAMPP, AMPPS, etc.) where you can use all the resources available then importing the database to your website.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Sakz » Thu Jul 12, 2012 10:29 am

Doing all of that is a bit beyond what I am capable of doing it. I'm hoping there is some easier solution.

Newbie

Posts

Joined
Thu Jul 12, 2012 5:37 am

Post by rph » Thu Jul 12, 2012 7:01 pm

You can ask your host to increase the memory limit again though it's unlikely they will unless you have a high spec VPS or dedicated server.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Sakz » Fri Jul 13, 2012 2:58 am

I currently have a VPS, but even when we increased the memory to 4 GBs the file still gave me the same error.

Newbie

Posts

Joined
Thu Jul 12, 2012 5:37 am

Post by rph » Fri Jul 13, 2012 3:10 am

How many products are you trying to import?

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Sakz » Sat Jul 14, 2012 3:48 am

A little over 2500.

Newbie

Posts

Joined
Thu Jul 12, 2012 5:37 am

Post by rph » Sat Jul 14, 2012 5:23 am

Should be okay. Try importing 250 products and see what happens.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by newdepth27 » Tue Jul 31, 2012 10:51 pm

I am using OpenCart v 1.5.2.1. When using the Export/Import tool to export I was receiving a similar "allocated memory" error as many have posted here. I read the form post and made changes to my php.ini file as instructed. I uploaded the php.ini file with the following modifications: updated "memory_limit = 2048M" and "post_max_size = 16M". Unfortunately, making these changes to the php.ini file did not resolve the issue, I was still unable to export products.

When I tried to preform an export I would receive a spreadsheet that contained nothing but the following message:

Code: Select all

<b>Fatal error</b>:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 80 bytes) in <b>.../public_html/store/system/database/mysql.php</b> on line <b>29</b><br />. 
After doing some research I realized that the number in the error I received (134217728 bytes) was actually equal to 128m. I searched the Import/Export mod code and found a reference to 128M located in: /admin/controller/tool/export.php on line 75, ini_set("memory_limit","128M"); I commented out the value ini_set("memory_limit","128M"); by adding a "//" at the front of this line so it now looks like "// ini_set("memory_limit","128M");". As soon as I uploaded this revised file the export feature began to work. In my case, it turned out that the memory limit was not due to my hosting provider but due to a parameter set in the code itself.

I found this same problem was present when trying to import. I received a similar error message when trying to import except this time the import was failing at 536870912 bytes or 512M. I once again searched the code for the mod and found 512M listed in this file: /admin/model/tool/export.php on line 1589. I once again commented out this line by adding "//" at the front resulting in "// ini_set("memory_limit","512M");". I then uploaded the modified php file and it worked perfectly! The import took 60+ seconds to complete but it no longer timed out and produced the error message.

I just wanted to post the solution that worked for me in case anyone else is experiencing the same issue. My problem appears to have been caused by memory limit restrictions in the Import/Export mod code and not in my php.ini file or hosting provider settings.

Newbie

Posts

Joined
Tue May 08, 2012 5:26 am

Post by JNeuhoff » Tue Jul 31, 2012 11:08 pm

newdepth27 wrote: I just wanted to post the solution that worked for me in case anyone else is experiencing the same issue. My problem appears to have been caused by memory limit restrictions in the Import/Export mod code and not in my php.ini file or hosting provider settings.
Thanks for sharing that with us. I think I'll remove these lines in the next release of the Export/Import tool, and let it always use whatever PHP settings are in the php.ini or .htaccess.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by cruk » Sun Sep 22, 2013 1:31 am

I'm receiving this error when trying to import. I only have around 100 products so shouldn't be a problem

I've also tried increasing the memory limit in php.ini with no success. Any help would be greatly appreciated

I'm using Opencart 1.5.6

Andy


Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4194304 bytes) in /home/andy/public_html/system/PHPExcel/Classes/PHPExcel/Reader/Excel2007.php on line 950

Newbie

Posts

Joined
Mon Aug 06, 2012 11:54 pm

Post by kajalpanda » Wed Oct 16, 2013 10:23 pm

Hi,
I am also facing the same error but only while importing the file. We tried "commenting out" as per Newdepth27 but the problem still persists.
We are using opencart version 1.5.2 and the export import module version 1.5.3. Trying since really long to get this sorted but not able to.

Please help us with this as soon as you can, Many Thanks !

Kajal

Newbie

Posts

Joined
Wed Oct 16, 2013 10:14 pm

Post by JNeuhoff » Fri Oct 18, 2013 7:46 pm

kajalpanda wrote:Hi,
I am also facing the same error but only while importing the file. We tried "commenting out" as per Newdepth27 but the problem still persists.
We are using opencart version 1.5.2 and the export import module version 1.5.3. Trying since really long to get this sorted but not able to.

Please help us with this as soon as you can, Many Thanks !

Kajal

Google is your friend.

Also, using opencart version 1.5.2 and the export import module version 1.5.3 is a non-matching combination.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by butte » Sat Oct 19, 2013 6:22 am

This also follows other but similar contexts at http://forum.opencart.com/viewtopic.php ... 23#p447623

Well, now, things are lookin' up for the long haul. The now fewer instances where workable adjustments don't work can be subdued.

newdepth27 contributed:
http://forum.opencart.com/viewtopic.php ... 06#p326417
export remedied in/admin/controller/tool/export.php on line 75,
// ini_set("memory_limit","128M");
and import remedied in admin/model/tool/export.php on line 1589,
// ini_set("memory_limit","512M");"

So, we know that the export.php overrides server-honored php.ini and .htaccess;
and that export.php is honored along with php.ini and .htaccess;
and that those two lines are the overrides (line numbers may vary among in versions).

JNeuhoff contributed:
http://forum.opencart.com/viewtopic.php ... 06#p326426
. . . "think I'll remove these lines . . . and let it always use whatever PHP settings are in the php.ini or .htaccess."

So, we know that export.php can kick in its own php.ini values AS IT NEEDS THEM ON THE SPOT.
and that routinely php.ini and .htaccess can sustain lower values than the tool needs.

Then the tricky part is whether the server honors those changes immediately. Tests with phpinfo.php suggest yes.

It appears, then, that there are a couple of potentially "complete" solutions.

(1) Use phpinfo.php to verify that changes have effect, i.e., server honors php.ini
how: upload into /admin/, address it as http: // [...]/admin/phpinfo.php in browser address bar
file: http://forum.opencart.com/download/file.php?id=18153

(2) Reset both php.ini files
to elevate execution, mem, post, upload maxima
to 300, 512M, 999M, 998M
or if appropriate
even to 300, 1024M, 999M, 998M

e.g., http://forum.opencart.com/viewtopic.php ... 80#p444711
max_execution_time = 300
memory_limit = 256M ;[or even 512M]
post_max_size = 999M
upload_max_filesize = 998M

(3) Reset inside export.php, at EACH of the two lines, for mem AND for three additional values,
to elevate execution, mem, post, upload maxima -- ALL FOUR PLUS ANY OTHERS FOUND TO BE CRUCIAL
to 300, 512M, 999M, 998M
or if appropriate
even to 300, 1024M, 999M, 998M

(3)(a) Modify in export.php the existing two lines plus six added lines (1+3, 1+3);

(3)(b) Equip export.php to require once an external short file with nothing more in it than those values;

(3)(c) Equip export.php with input from admin panel, which will be open anyway to export or import using the tool.

Item (1) is just a confirmation tool. Item (2) can support sustained php.ini settings, at lesser values than are required by item (3). Item (3) can support extraordinary demands by export.php. Items (3)(a), (3)(b), (3)(c) offer differing or mutually complementary means to change (3).

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am
Who is online

Users browsing this forum: No registered users and 7 guests