We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    Have any of you ever had to make a backup of a site that is considerably large?

    If so, you may have seen an error like this in your backup file:


    <b>Fatal error</b>: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3145728 bytes) in <b>/home/username/public_html/manager/actions/bkmanager.static.php</b> on line <b>356</b>


    Does anyone have any recommendations on server configuration for large sites that need to make a backup via the manager?

    I believe PHP memory_limit needs to be increased, but what happens as the site grows over time? What about shared host accounts?

    Adding the following in manager/.htaccess worked for me laugh
    php_value memory_limit 100M
    
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 22303 MODX Staff
      • 10,725 Posts
      Honestly, MySQL database backups should really be performed using mysqldump. Many shared accounts have access to these features via graphical user interfaces, but having access to it via SSH is definitely preferable.

      Your always going to be limited by memory when trying to dump entire tables with PHP. You would need to write ways to read and write records using buffers of x numbers of rows, and release the memory as you go to come up with an efficient process that would work in PHP regardless of the number of records you are backing up.
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Link: http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

        mysqldump [options] --databases modx > modx_backup.sql

        What are the recommended set of options (e.g. --opt), or even better, the ones MODx Backup Manager use?

        mysqldump is indeed the way to go, especially for Large Backups...so much faster anyway. (For both import/export)
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.