Forums / Addon Admin Tools / Backup MySQL Database

Backup MySQL Database

Views: 87,442

Results 281 to 300 of 327
19 Jan 2025, 3:12 PM
#281
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Backup MySQL Database

In using the plugin to Restore a newer version of my database to my upgrading site today, I encountered this error.....

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 454834832 bytes) in /home/mysite/public_html/new210/zc_plugins/BackupMySQL/v2.0.0/admin/backup_mysql.php on line 620

I am using a .gz file from my current site, dropped into the Admin->backups folder as usual. I wasn't able to find the area in this file to increase the allowable file size....would you be able to point me in the right direction?

Thanks!

19 Jan 2025, 3:36 PM
#282
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Backup MySQL Database

NWCE:

In using the plugin to Restore a newer version of my database to my upgrading site today, I encountered this error.....

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 454834832 bytes) in /home/mysite/public_html/new210/zc_plugins/BackupMySQL/v2.0.0/admin/backup_mysql.php on line 620

I am using a .gz file from my current site, dropped into the Admin->backups folder as usual. I wasn't able to find the area in this file to increase the allowable file size....would you be able to point me in the right direction?

Thanks!
A guess, since I don't use this plugin: Configuration / Maximum Values / Maximum File Upload Size

Barring that, what shows for PHP Memory Limit when you display Tools / Server/Version Info?

19 Jan 2025, 3:53 PM
#283
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

Looks like a memory limit, not a filesize limit.

...and I have comments on 620...you using the latest version?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

19 Jan 2025, 4:07 PM
#284
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Thank you lat9 for your reply and suggestions! My max file upload size it the default of 2048000 and my PHP memory limit is 512M. It appears these values should work...but let me know if I'm missing something.

Thanks as well Torvista for your reply and yes, I am using the latest version of yours from Github...which is also why I'm posting as you mentioned you'd like to have real use feedback. As I had removed all of the debris from my last errors we discussed a few posts ago....I was thinking that this shouldn't be an issue???

What else would you suggest?

19 Jan 2025, 6:08 PM
#285
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

So you can backup as a .gz from your production store but not restore...on the same server?

Can you backup/restore as a .zip?

What size are the files?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

19 Jan 2025, 9:40 PM
#286
dysfunctional avatar

dysfunctional

Zen Follower

Join Date:
Apr 2008
Posts:
159
Plugin Contributions:
0

Re: Backup MySQL Database

Just downloaded from github and tested on my local webserver (ubuntu 24.04) with zen cart 2.1.0 and php 8.3. Worked for me without any issues. Nice work!

19 Jan 2025, 10:17 PM
#287
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Thanks again for your reply Torvista. Yes, this is correct...I can backup, but when I try to restore is when I get this issue. This production site is in a sub folder on my live site server now...so this is where I am testing once again with my current store database in this environment.

I have just tried backing up as a .zip file in this test site and all worked perfectly. File size is 68,896Kb.

I am then saving my live site database, placing it in the Admin->Backups folder in my test site and then trying to restore it in. On my live site, I am using this same plugin (version 1-5g)for Zen Cart v.1.5.8. It does not have the option to save as just a .zip file. Can only save as .gz or pure SQL

20 Jan 2025, 4:01 PM
#288
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

Confused.

Your test site and your production site on the same server.
One would assume they have the same limits and php extensions.

But the test one offers .zip backup and restore (since it has detected the extension) but the production does not.

Perhaps you should compare the phpino (version info) for both sites for one thing.

As for runnng out of memory, you could put a higher memory limit value in an ini_set at the start of the backup script to test.

Perhaps the previous poster could indicate what format he used, the filesize and the server memory limit.

My file is only 25MB.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

20 Jan 2025, 4:34 PM
#289
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Thanks for your reply Torvista....

Sorry if my post was confusing.....it seems like there are many things at play here.

I was thinking overnight....and I thought I should just start from scratch if others are not experiencing any issues.

I made a fresh install of ZC v.2.1 and a new database in my local computer. I did not install my merged custom files first.....I tried installing the plugins (only the ones that use the zc_plugins folder to install) first and have had success with this install. I then tried Backup (nothing much in the database, just the demo info) and then used this backup to try the Restore function in the plug in and it all worked perfectly.

I will now progress on installing my merged custom files and other addons and will continue to backup and restore with each addition to see if/where it breaks.

Thank you for your help with this and I will reply once I have installed the rest and what my results are.

31 Jan 2025, 3:20 PM
#290
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Hi again Torvista....now that I have progressed in my development site to installing all Addon plugins and testing to insure I have no errors....I went to the last step of installing a copy of my live site database into this development site.

In using the latest version of this plugin and using the plugin to install my v.1.5.8 live site database I received the error once again about size limits.

Allowed memory size of 134217728 bytes exhausted (tried to allocate 455462288 bytes) in C:\wamp64\www\new2121\zc_plugins\BackupMySQL\v2.0.0\admin\backup_mysql.php on line 612

It is a 70Kb database (not sure if that's deemed as large). While I was able to successfully Backup and Restore the database when it only contained the stock demo data....as soon as it is larger....I get this error and am unable to use this plugin to get my database in. I have then resorted to using the Import function in PhPMyAdmin.

Would you be able to point me in the right direction on how to fix this memory issue?

Thanks!

31 Jan 2025, 4:06 PM
#291
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

You have a memory limit set of 128M.

My db is 25MB and it fails immediately on a restore until I have 448M or above.

You could increase the memory limit globally or just stick these at the start of the file and experiment uncommenting one at a time to see what you need:

/** for phpStorm
 * @var queryFactoryResult $db
 * @var messageStack $messageStack
 */
ini_set('memory_limit', '256M');
//ini_set('memory_limit', '320M');
//ini_set('memory_limit', '384M');
//ini_set('memory_limit', '448M');
//ini_set('memory_limit', '512M');

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

31 Jan 2025, 5:02 PM
#292
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Thanks for your reply and help Steve!

I did add this in to the file and commented out the first line with 256M and uncommented the last line with 512M.

I then tried Restore again and this was my error:

[31-Jan-2025 16:54:08 UTC] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 455454064 bytes) in C:\wamp64\www\new2121\zc_plugins\BackupMySQL\v2.0.0\admin\backup_mysql.php on line 626
[31-Jan-2025 16:54:08 UTC] PHP Stack trace:
[31-Jan-2025 16:54:08 UTC] PHP 1. {main}() C:\wamp64\www\new2121\admin\index.php:0
[31-Jan-2025 16:54:08 UTC] PHP 2. require() C:\wamp64\www\new2121\admin\index.php:28
[31-Jan-2025 16:54:08 UTC] PHP 3. str_replace($search = '/*M!999999\- enable the sandbox mode */', $replace = '', $subject = '/*M!999999\- enable the sandbox mode / \n-- MariaDB dump 10.19 Distrib 10.6.19-MariaDB, for Linux (x86_64)\n--\n-- Host: localhost Database: v_158\n-- ------------------------------------------------------\n-- Server version\t10.6.19-MariaDB\n\n/!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /;\n/!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /;\n/!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /;\n/!40101 SET NAMES utf8mb4 /;\n/!40103 SET @OLD_TIME_ZONE=@'..., $count = 0) C:\wamp64\www\new2121\zc_plugins\BackupMySQL\v2.0.0\admin\backup_mysql.php:626

[31-Jan-2025 16:54:08 UTC] Request URI: /new2121/admin/index.php?cmd=backup_mysql&file=db_v_158-20250127071022.sql.gz&action=restorenow, IP address: 127.0.0.1
--> PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 455454064 bytes) in C:\wamp64\www\new2121\zc_plugins\BackupMySQL\v2.0.0\admin\backup_mysql.php on line 626.

[31-Jan-2025 16:54:08 UTC] Request URI: /new2121/admin/index.php?cmd=backup_mysql&file=db_v_158-20250127071022.sql.gz&action=restorenow, IP address: 127.0.0.1
--> PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 455454064 bytes) in C:\wamp64\www\new2121\zc_plugins\BackupMySQL\v2.0.0\admin\backup_mysql.php on line 626.

The first bit of the error almost looks as if there are old fragments that it doesn't like. I had run the zc_install after inserting this database in to update it and I have also run the database converter tool. I then ran the Restore and this (above was my error).

It still seems to have memory errors.....

Any ideas??

31 Jan 2025, 9:11 PM
#293
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

Is it the same problem if it is zip or gzip?

Have you manually extracted the file to have a look at it/check it is not corrupted in some way?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

31 Jan 2025, 9:39 PM
#294
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

I am backing up on my live site using this plugin (v.3) as my live site is Zen Cart v.1.5.8

This plugin at that version only gives the option of No Compression or gzip

As for it being corrupt....I have tested everything else on my development site both on the site and Admin and the only 2 plugins (I have about a dozen installed) that I am having errors with is this one and Instant Search....so I wouldn't think it was corrupted. I will check though.

Is it possible that there is a file with a memory_limit such as in Admin/includes/functions/general.php (calling it) that is setting the memory limit??

I have run a backup in my development site using this plugin as a .zip rather than gzip. I then used this backup and used Restore. All worked fine, I received the green messages in the Admin panel top detailing that it was successful....I then took a look around the site and clicked on products, Add to Cart, etc. and the development site works perfectly (except Instant Search still...Undefined Constant)

Do you think this was coincidence that the Restore worked as a zip because I was restoring the exact, unchanged database??

So it seems that if the database is saved as a zip it works....as a gzip it throws the memory limit error. Any other thoughts as to what this could be???

1 Feb 2025, 1:06 PM
#295
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

so I wouldn't think it was corrupted.
I mean the file you are trying to restore: un-gzip it and look with a text editor that all looks above board.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

1 Feb 2025, 1:31 PM
#296
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Hi Steve....

Makes sense to check...

I have now done this and viewing it in Notepad ++ everything is there and legible....No corruption.

Do you have any other thoughts on why it works as zip file rather than a gzip??

I guess I can move on as I can import my database as a zip file and by pass the gzip option.

Thank you for your help with this plugin and I will subscribe to the thread to watch for further developments!

Thanks again!

1 Feb 2025, 3:20 PM
#297
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

What is the database version?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

1 Feb 2025, 3:32 PM
#298
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

...on each server.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

1 Feb 2025, 3:43 PM
#299
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

My database that I have copied in from my live site is V.1.5.8 and I then have run the zc_installer to update the database to v.2.1

The database goes back awhile as we've had our store since 2006....not sure if that's important or not....so we've been through all of the upgrades since then.

I have also run the database converter plugin to insure that it corrects everything. The db_charset in my config files is utf8mb4 on both my live and development sites. Again...not sure if this provides any clues....just trying to give the full picture.

Thanks for your help!

1 Feb 2025, 3:45 PM
#300
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

No. I meant the database server..MySQL/Maria and their versions.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...