Forum

Thread tagged as: Problem, Runway

Runway backups to DropBox have stopped

I have 3 Runway sites, where the backups to DropBox have been working for quite some time. One site is Runway 2.8.34 and two sites are Runway 3. The sites are a mix of PHP 7.0.17 and 7.1.3. I've checked that the 'handler_path' is correct for the Runway 3 sites, and the backups were working for several days before they stopped.

The date they stopped has coincided with a server migration. Overnight on March 31, we moved (with the some company) to a Cloud-based server running CentOS 7.3. Previously I think we were CentOS 5.x.

The scheduled task is running correctly and reporting backups are being made. Manually running Backup (from the View Backup Plan screen) appears to work fine. I then switched on Diagnostics for one of the sites and get THIS error when manually creating a backup ...

Array
(
    [type] => 2
    [message] => copy(dropbox://backups/db_daily_201704031251.sql.gz): failed to open stream: no suitable wrapper could be found
    [file] => /home/aamagazine/public_html/perch/core/runway/lib/PerchBackupPlan.class.php
    [line] => 235
)

Here's the debug output before that error appears ...

Debug Message - Perch Runway 3.0
[1] SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='406750bac8a365bb9dac7b0b2dd6f97f' LIMIT 1
UPDATE perch2_users SET userHash='f14c0e845db8c283bca5dceafaac9bf7' WHERE userID='1'
[29] SELECT p.privKey FROM perch2_user_privileges p
[14] SELECT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[7] SELECT itemValue FROM perch2_menu_items WHERE itemType='app'
[1] SELECT * FROM perch2_backup_plans WHERE planID=1 LIMIT 1
INSERT INTO perch2_backup_runs(planID,runDateTime,runType,runResult,runMessage,runDbFile) VALUES('1','2017-04-03 12:51:43','db','OK','Completed','db_daily_201704031251.sql.gz')
[1] SELECT * FROM perch2_backup_runs WHERE runID='41' LIMIT 1
Setting alert: The backup completed successfully. (success)
[20] SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_backup_runs WHERE planID=1 ORDER BY runDateTime DESC LIMIT 0, 20
[41] SELECT FOUND_ROWS() AS `count`
[1] SELECT * FROM perch2_menu_items WHERE itemActive=1 AND itemType='menu' AND parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[2] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch2_menu_items WHERE itemType='app' AND itemValue='settings' LIMIT 1
[1] SELECT * FROM perch2_menu_items WHERE itemActive=1 AND itemType='menu' AND parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: /core/runway/settings/modes/backup.runs.list.post.php
Mode: backup.runs.list
Queries: 16
Memory: 2.3172

Here's the Extended Diagnostics Info from the site (with some info redacted as its not yet a production site) ...

Perch Runway: 3.0
Production mode: Production (100)
Installed apps: content (3.0), assets (3.0), categories (3.0), jw_activity_log (1.0.1)
DB driver: PDO
DB tables: perch2_backup_plans (1), perch2_backup_resources (0), perch2_backup_runs (41), perch2_categories (0), perch2_category_counts (0), perch2_category_sets (0), perch2_collection_index (0), perch2_collection_items (0), perch2_collection_revisions (0), perch2_collections (0), perch2_content_index (13), perch2_content_items (8), perch2_content_locks (0), perch2_content_regions (3), perch2_jw_activity_log_actions (2), perch2_menu_items (9), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_routes (0), perch2_page_templates (3), perch2_pages (4), perch2_resource_log (0), perch2_resource_tags (0), perch2_resources (0), perch2_resources_to_tags (0), perch2_scheduled_tasks (20), perch2_settings (15), perch2_user_passwords (1), perch2_user_privileges (29), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (3)
Users: 3
App runtimes:
<?php
    $apps_list = [
    ];
Scheduled tasks for jw_activity_log: prune_actions_log (1440 mins)
Scheduled tasks for Backup: plan_1 (10 mins)
Editor plug-ins:
H1: 6dfbbb1388b94b6ffba3a315d77e3ad5
L1: 4fc7de731d5ab6d9b7a731caf92e12c1
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
headerColour: rgb(54,54,54)
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.34: done
headerScheme: dark
update_runway_2.8.34: done
latest_version:
on_sale_version:
jw_activity_log_prune_time: 30
update_runway_3.0: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /home/aamagazine/public_html
PERCH_SCHEDULE_SECRET: 13xbMA8voAHwLvHY
PERCH_DB_USERNAME: aamagazi_radmin
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: aamagazi_runway
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: grahamstreet@streets-ahead.com
PERCH_EMAIL_FROM_NAME: Graham Street
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/aamagazine/public_html/perch
PERCH_CORE: /home/aamagazine/public_html/perch/core
PERCH_RESFILEPATH: /home/aamagazine/public_html/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: c4c70b856b16830782ef
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/aamagazine/public_html/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings

PHP: 7.1.3
Zend: 3.1.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
MySQL server: 5.5.5-10.1.22-MariaDB
Free disk space: 27.75 GB
Extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, readline, Reflection, SPL, session, standard, cgi-fcgi, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imap, intl, json, exif, mcrypt, mysqlnd, PDO, Phar, posix, pspell, SimpleXML, soap, sockets, sqlite3, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, pdo_sqlite, wddx, xmlreader, xmlrpc
GD: Yes
ImageMagick: No
PHP max upload size: 20M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 8M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
AUTH_TYPE: Basic
CONTEXT_DOCUMENT_ROOT: /home/aamagazine/public_html
DOCUMENT_ROOT: /home/aamagazine/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.8
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: PHPSESSID=d6v762hiv48q33447hjb938ee1; cmsa=1
HTTP_HOST: www.*****.co.uk
HTTP_REFERER: https://www.*****.co.uk/perch/core/settings/diagnostics/
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
PATH: /bin:/usr/bin
PHP_AUTH_PW: *****
PHP_AUTH_USER: *****
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 82.71.57.159
REMOTE_PORT: 54483
REMOTE_USER: *****
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/aamagazine/public_html/perch/core/settings/diagnostics/index.php
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
SERVER_ADDR: 185.41.8.195
SERVER_ADMIN: webmaster@*****.co.uk
SERVER_NAME: www.*****.co.uk
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
UNIQUE_ID: WOJIu3fou6NVUA0duHRMeAAAAAk
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1491224763.2027
REQUEST_TIME: 1491224763
argc: 1
Graham Street

Graham Street 17 points

  • 4 years ago

Some more info ...

config/buckets.php contents ...

<?php 
    return [
        'backup' => [
                 'type'      => 'dropbox',
                 'web_path'  => '',
                 'file_path' => 'backups',
         ],
    ];

Does a folder called /backups need to exist? If so, where? I'm wondering if the migration hasn't copied it across because of where the folder existed in the account setup within CPanel.

I've also found an error_log in /perch/core/settings/backup. It contains these entries ...

[03-Apr-2017 13:19:16 UTC] PHP Warning:  copy(): dropbox:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/aamagazine/public_html/perch/core/runway/lib/PerchBackupPlan.class.php on line 235
[03-Apr-2017 13:19:16 UTC] PHP Warning:  copy(dropbox://backups/db_daily_201704031319.sql.gz): failed to open stream: no suitable wrapper could be found in /home/aamagazine/public_html/perch/core/runway/lib/PerchBackupPlan.class.php on line 235

Does this indicate a setting error on the new server?

Graham

Drew McLellan

Drew McLellan 2638 points
Perch Support

This would be the problem I think:

dropbox:// wrapper is disabled in the server configuration by allow_url_fopen=0

Indeed it is/was. Just before you posted, we got to the bottom of it. I had my host change the PHP setting for PHP7.1 so we could try a test. It worked and the backup finished. At the moment I'm unsure if CPanel have made 'off' the new default or if my hosting company set it this way. I'm about to ask this of them. They already told me that allow_url_fopen can't be enabled per-user, so it can't be adjusted with php.ini or in htaccess. I don't recall ever needing to change this setting before, so I would assume that 'on' has always been the default. That might be an issue for you, if 'off' is now the default?

So, we've changed the PHP setting for our server version of PHP 7.1 - and moved all Runway setups to that PHP level. The backups now work again.

My server company told me this ... 'On' is still the default in PHP itself, but it's discouraged, and cPanel now turns it off by default. They also told me ... This isn't tied to specific versions of cPanel but whether the server is using Easyapache 3 or 4 to manage PHP and Apache. All new servers are now configured for Easyapache 4 as Easyapache 3 will become end of life January of 2018.

This URL confirms that for CPanel/WHM version 62 - https://documentation.cpanel.net/display/ALD/MultiPHP+INI+Editor+for+cPanel

I suspect, therefore, that more people could encounter this in time. They will have to make that PHP change unless you can avoid the need for allow_url_fopen being 'on' by doing things a different way.

Graham

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not clear why allow_url_fopen should also block a custom stream, but I'll look into it.

Happy to try or test anything, when the time arrives.

For the PHP 7.1 'handler' we have allow_url_fopen set to 'on'. As a result, manual backups were then working. The scheduled tasks were still running (via CRON) but we couldn't then see why the scheduled backup to DropBox wasn't happening. Then we found that (by default) CRON was running the server default of PHP 5.6 where allow_url_fopen is 'off'. We've now adjusted the CRON statement to run PHP 7.1 too, for the Runway sites. Now all the scheduled backups to DropBox are now running again.

So, we are fixed but I fear others may encounter this if they are using the PHP supplied versions in MultiPHP Manager and newer versions of CPanel and EasyApache. We're only seeing this now as we migrated to a new server over the weekend and everything's up to date.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I need to dig into the PHP source code to determine the actual impact of declaring a stream wrapper as being a URL handler vs a local stream. It seems to be that this is what causes the wrapper to be blocked. Not sure if just lying about it might be the solution or if there's a functional impact.

I think there's a reasonable expectation that if you're using Runway you have control of your server, so I'm not sure how much of an issue it actually is.