We have been using the s3-php-curl library for some time successfully. It's a great utility that allows you to save, manage, and schedule backups to Amazon's S3 service through the Drupal user interface.

However, we noticed that the library causes Backup and Migrate to go whitescreen on our Ubuntu 14 server installations running PHP 5.5.9. In particular, you can't access Backup and Migrate's restore tab without getting a blank screen.

We discovered this issue migrating from older development instances in Ubuntu 12 to newer production instances in Ubuntu 14, and we don't experience this bug on the older Ubuntu 12 instances.

The downloads of the S3-php5-curl library available on the Undesigned blog page (http://undesigned.org.za/2007/10/22/amazon-s3-php-class/) are out of date, and it doesn't look like the library is being maintained. The backup_migrate module should probably use a different solution going forward.

Our solution has been simple: we delete the S3-php5-curl library, and the restore page reappears, albeit with errors. In older versions of backup and migrate we can delete the S3 destinations and make the errors go away. However, there is no affordance in newer versions of the backup_migrate to delete backup destinations (perhaps that's an oversight?).

We have cobbled together a cron task using a command line utility for S3 (s3cmd) and a very basic shell script to achieve the same functionality:

First install s3cmd

sudo apt-get install s3cmd

Next, create a scripts folder (if you don't have one already) and create a shell script:

mkdir ~/scripts
nano ~/scripts/s3-sync.sh

Add a modified version of the following into your editor:

#! /bin/bash

# sync F1 all backups directories with S3 bucket
s3cmd sync /[path to drupal root]/sites/default/private/backup_migrate/ s3://[your-bucket-name]/[folder]/

# now append a record to the log file
#
echo "$(date -R) | sync F1 backups directories with S3 bucket" >> /[path to log folder]/sync.log
echo  "finished syncing backups directories to S3"
#

Next, add a cron task

crontab -e

and add a modified version of this example to your cron file to run the script 4 times a day at 05:57, 11:57, 17:57 and 23:57:

# m h  dom mon dow   command

57 05,11,17,23 * * * /home/[username]/scripts/s3-sync.sh

I'm hoping other folks will feel free to improve on this very basic approach.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sammy-node’s picture

Modulist - thanks for the short-term fix above

Separately I'd be keen to see someone address the issue raised above and would be happy to contribute a fee for it to be sorted out.

dman’s picture

AWS for backup_migrate works OK on PHP 5.3.18 and 5.4.8 (according to Acquia dev desktop) But I was able to replicate the WSOD on PHP 5.5.9-1ubuntu4.5

The error (in /var/log/apache2/error.log) was

PHP Fatal error:  Call to undefined function curl_init() in sites/all/libraries/s3-php5-curl/S3.php on line 1217, referer: /admin/config/system/backup_migrate/destination

So ... it looks like this fresh Ubuntu box needs to have cURL turned on.

sudo apt-get install php5-curl

With a restart,
* The WSOD was gone, and
* Backups were being saved correctly to S3.

So mainly - it looks like the module just needs to check that cURL extension is available before calling the s3 php library.
And so do the users that install it...

However, there looks to be a small issue with PHP 5.5 still.
When trying to *list* the backup files, I got

Notice: Undefined property: stdClass::$body in S3Request->__responseWriteCallback() (line 1333 of /sites/all/libraries/s3-php5-curl/S3.php).

But I was able to confirm (through the AWS console) the the files were up there, so that's the important bit for now.

dman’s picture

Following up, I traced the reason files were not being listed - it seems a bit odd inside the REST request, so after looking for a while, I decided to upgrade the s3-php library

The original (2009) from http://undesigned.org.za/2007/10/22/amazon-s3-php-class/
is now being supported on github (as you can tell by the info on the project page)
The download you can fetch from https://github.com/tpyo/amazon-s3-php-class

You can clone it with

git clone https://github.com/tpyo/amazon-s3-php-class.git  s3-php5-curl

or download from https://github.com/tpyo/amazon-s3-php-class/archive/master.zip and rename to s3-php5-curl

Surprisingly, the API seems to have been kept stable, and it just drops right in!

sammy-node’s picture

OK nice one - thanks Dan - using the Github repo version of the library worked perfectly

modulist’s picture

Thanks dman for your posts... they resolved the issue. Perhaps it could get included in the installation instructions for the module!

couturier’s picture

Component: Code » Documentation
Category: Bug report » Feature request
Status: Active » Postponed (maintainer needs more info)

Is this still an issue with 7.x-3.2?

couturier’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Closing after more than two weeks with no activity.

sano’s picture

good work @dman. thanks.

couturier’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Status: Closed (outdated) » Active

This should be put in current documentation if it is still an issue.

sano’s picture

I think it should be sufficient to modify the Readme file. Currently it states:

OPTIONAL:
* Enable token.module to allow token replacement in backup file names.
* To Backup to Amazon S3:
- Download the S3 library from
http://undesigned.org.za/2007/10/22/amazon-s3-php-class
and place the file 'S3.php' in the includes directory in this module.
The stable version (0.4.0 – 20th Jul 2009) works best with Backup and
Migrate.

...should probably read:

OPTIONAL:
* Enable token.module to allow token replacement in backup file names.
* To Backup to Amazon S3:
- download the most recent version from https://github.com/tpyo/amazon-s3-php-class
- You can clone it with command:
git clone https://github.com/tpyo/amazon-s3-php-class.git s3-php5-curl
-... or download from https://github.com/tpyo/amazon-s3-php-class/archive/master.zip
- rename the unzipped folder to s3-php5-curl

The most recent version of the library known to work is 0.5.1, with the Backup & Migrate module version 7.x-3.5+8-dev

couturier’s picture

@sano Thanks! I believe that we update documentation through patches, correct? Otherwise we would have to assign this to a maintainer who can go in and manually change the text file. @sano Can you write a patch for README.txt?

sano’s picture

Here is the patch. Hopefully I made no mistakes creating/naming it.

couturier’s picture

Thank you! Hopefully we can get this reviewed in time to add to the next release. We appreciate your help. The maintainers for this module do work in spurts, so you should see a round of activity just before the next release.

couturier’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: readme_update-2382541-12.patch, failed testing. View results

DamienMcKenna’s picture

Status: Needs work » Needs review
Parent issue: » #2942331: Plan for Backup and Migrate 7.x-3.6
FileSize
973 bytes

Rerolled and tidied up a little bit.

  • DamienMcKenna committed 3988496 on 7.x-3.x
    Issue #2382541 by sano, DamienMcKenna, couturier, dman, modulist:...
DamienMcKenna’s picture

Committed. Thanks all.

DamienMcKenna’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.