• Resolved RT_PDX

    (@ronald2020)


    Hi there!

    I was excited tor try this plugin. Install was straight forward but when i configure everything and do a manual backup i get the following php error (in my server logs):

    Got error ‘PHP message: PHP Warning: touch(): Unable to create file /home/xxxxxx.cloudwaysapps.com/cqtxpacctq/156517915.txt because Permission denied in /home/xxxxx.cloudwaysapps.com/cqtxpacctq/public_html/wp-admin/includes/class-wp-filesystem-direct.php on line 516’, referer: https://mywebsite.com/wp-admin/admin.php?page=boldgrid-backup-settings

    The manual backup screen does not refresh. It just closes pretty quickly. The plugin does not create any log file (under the plugins tools tab) that could be of help either. I also noticed that when i do a preflight check i get this under the Possible backup directory parents section:

    /home/xxxxx.cloudwaysapps.com/cqtxpacctq
    /home/xxxxx.cloudwaysapps.com/cqtxpacctq/public_html/wp-content

    The first directory is not writable (by design). The second is. Is looks like the php error is caused because the touch() command bombs on trying the first only. How do we force it to use the second directory ?

    Thanks much!

    R

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Jesse Owens

    (@jessecowens)

    Hi @ronald2020

    Thanks for the question! You can switch the backup directory using the instructions in this article: https://www.boldgrid.com/support/total-upkeep/backup-directory/

    Here’s a brief TL;DR- Navigate to Total Upkeep – Settings – Backup Storage and click on the Update link next to the server storage option. Here you can specify your backup directory.

    By default, Total Upkeep uses the directory outside public_html so that your backups aren’t exposed to the internet. If your permissions structure don’t allow for that, I highly recommend using the Backup Encryption feature, or use an htaccess configuration to password protect your backup directory.

    Thread Starter RT_PDX

    (@ronald2020)

    Hi Jesse !

    Thanks, i had checked that but interestingly the backup directory for storage WebServer says: /home/xxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-content/boldgrid_backup_I_REDACTED_THE_SECRET_NUMBER

    But I still get the touch() error for : /home/xxxxx.cloudwaysapps.com/xxxxxxxx/1775784020.txt

    The good news … we have some log files. I also received an email. But there is no physical backup file anywhere. Interestingly it says it has uploaded it to FTP successfully but there is no file there either (makes sense as the one on disk was never created it seems). I noticed a few other things (like dashboard says i need to create a schedule even though i have one) but lets focus on the main issue first.I redacted less useful pieces from the log file:

    [2022-11-21 16:43:18 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:43:18 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:18 UTC] Last error: Array
    (
    [type] => 2
    [message] => file_get_contents(/home/xxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-content/boldgrid_backup_fOAEUy9aQEGs/logs-ba966913-9a3a12dc58677faf/archive-1669048998.log): Failed to open stream: No such file or directory
    [file] => /home/xxxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-admin/includes/class-wp-filesystem-direct.php
    [line] => 39
    )

    [2022-11-21 16:43:18 UTC] Backup process initialized.
    [2022-11-21 16:43:18 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:18 UTC] Backup process initialized.
    [2022-11-21 16:43:18 UTC] Process id: 30147
    [2022-11-21 16:43:18 UTC] ——————————————————————————–
    [2022-11-21 16:43:18 UTC] Starting dump of database…
    [2022-11-21 16:43:18 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 62652352 (59.75 MB) / 63492584 (61 MB)
    [2022-11-21 16:43:18 UTC] Database info: Array
    (
    [wp_actionscheduler_actions] => 88
    AND MANY MORE TABLES …
    )

    [2022-11-21 16:43:19 UTC] Dump of database complete! $status = 1
    [2022-11-21 16:43:19 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 62669312 (59.77 MB) / 64800024 (62 MB)
    [2022-11-21 16:43:19 UTC] ——————————————————————————–
    [2022-11-21 16:43:20 UTC] Database dump file added to file list: /home/xxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-content/boldgrid_backup_fOAEUy9aQEGs/cqtxpacctq.20221121-164318.sql / 10024361 (9.56 MB)
    [2022-11-21 16:43:20 UTC] Starting archiving of files. Chosen compressor: system_zip
    [2022-11-21 16:43:20 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69724288 (66.49 MB) / 70549192 (67 MB)
    [2022-11-21 16:43:20 UTC] Starting to create list of files to include in zip.
    [2022-11-21 16:43:20 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69723784 (66.49 MB) / 70709976 (67 MB)
    [2022-11-21 16:43:20 UTC] Finished creating list of files to include in zip. 10179 files in zip.
    [2022-11-21 16:43:20 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 71300440 (68.00 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:20 UTC] Starting to close the zip file.
    [2022-11-21 16:43:20 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69723944 (66.49 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:21 UTC] Chunk closed in 1.3636770248413 seconds. 9% complete closing
    [2022-11-21 16:43:21 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:23 UTC] Chunk closed in 2.4299309253693 seconds. 18% complete closing
    [2022-11-21 16:43:23 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:26 UTC] Chunk closed in 2.6857440471649 seconds. 27% complete closing
    [2022-11-21 16:43:26 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:29 UTC] Chunk closed in 2.8241548538208 seconds. 36% complete closing
    [2022-11-21 16:43:29 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:33 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:43:33 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:33 UTC] Backup process running: Yes (pgid = 25799)
    [2022-11-21 16:43:34 UTC] Chunk closed in 4.4925451278687 seconds. 45% complete closing
    [2022-11-21 16:43:34 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:36 UTC] Chunk closed in 2.1192529201508 seconds. 55% complete closing
    [2022-11-21 16:43:36 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:38 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:43:38 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:38 UTC] Backup process running: Yes (pgid = 25799)
    [2022-11-21 16:43:39 UTC] Chunk closed in 2.6316778659821 seconds. 64% complete closing
    [2022-11-21 16:43:39 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:43 UTC] Chunk closed in 4.1216731071472 seconds. 73% complete closing
    [2022-11-21 16:43:43 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:45 UTC] Chunk closed in 2.6905958652496 seconds. 82% complete closing
    [2022-11-21 16:43:45 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:48 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:43:48 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:48 UTC] Backup process running: Yes (pgid = 25799)
    [2022-11-21 16:43:49 UTC] Chunk closed in 3.3322350978851 seconds. 91% complete closing
    [2022-11-21 16:43:49 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Chunk closed in 2.1079170703888 seconds. 100% complete closing
    [2022-11-21 16:43:51 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70227272 (66.97 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Finished closing the zip file.
    [2022-11-21 16:43:51 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69723944 (66.49 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Starting to add db dump to the zip file.
    [2022-11-21 16:43:51 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69723944 (66.49 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Finished adding db dump to the zip file.
    [2022-11-21 16:43:51 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69724072 (66.49 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Archiving of files complete!
    [2022-11-21 16:43:51 UTC] Archive filepath / size: /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/boldgrid_backup_fOAEUy9aQEGs/boldgrid-backup-hannahswalk.info-ba966913-20221121-164320.zip / 169373328 (161.53 MB)
    [2022-11-21 16:43:51 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 69723944 (66.49 MB) / 72286880 (69 MB)
    [2022-11-21 16:43:51 UTC] Starting sending of email…
    [2022-11-21 16:43:53 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php
    [line] => 91
    )

    [2022-11-21 16:43:53 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:53 UTC] Backup process running: Yes (pgid = 25799)
    [2022-11-21 16:43:54 UTC] Sending of email complete! Status: 1
    [2022-11-21 16:43:57 UTC] Backup complete!
    [2022-11-21 16:43:57 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 70550672 (67.28 MB) / 80590552 (77 MB)
    [2022-11-21 16:43:57 UTC] Backup complete!
    [2022-11-21 16:43:57 UTC] Memory usage – limit / current / peak memory usage: 1073741824 / 63501096 (60.56 MB) / 80590552 (77 MB)
    [2022-11-21 16:43:58 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:43:58 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:43:58 UTC] Backup process running: Yes (pgid = 25799)
    [2022-11-21 16:44:10 UTC] Last error: Array
    (
    [type] => 8192
    [message] => Return type of FS_Key_Value_Storage::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => /home/xxxxxx.cloudwaysapps.com/xxxxxxxx/public_html/wp-content/plugins/wp-mail-log/freemius/includes/managers/class-fs-key-value-storage.php
    [line] => 389
    )

    [2022-11-21 16:44:10 UTC] Cannot add signal handlers, pcntl_async_signals function does not exist.
    [2022-11-21 16:44:10 UTC] Backup process running: No`

    • This reply was modified 2 months, 1 week ago by RT_PDX.
    Plugin Support Jesse Owens

    (@jessecowens)

    Hi @ronald2020

    Sorry for the late reply!

    There’s a lot of extraneous warnings in here that are most likely related to WordPress’s “beta” support for PHP versions above 8, but as near as I can tell this log indicates a successful backup. You can see these important lines:

    [2022-11-21 16:43:51 UTC] Finished closing the zip file.
    [2022-11-21 16:43:51 UTC] Starting to add db dump to the zip file.
    [2022-11-21 16:43:51 UTC] Finished adding db dump to the zip file.
    [2022-11-21 16:43:51 UTC] Archiving of files complete!
    [2022-11-21 16:43:51 UTC] Archive filepath / size: /home/xxxxxx.cloudwaysapps.com/xxxxxxxxx/public_html/wp-content/boldgrid_backup_XXXXXXX/boldgrid-backup-XXXXXXX.info-ba966913-20221121-164320.zip / 169373328 (161.53 MB)

    There are a few other things I can see of note. It looks like your server doesn’t enable some Process Control functions, which Total Upkeep uses to monitor the status of the backup process, but that doesn’t look like it caused any major issues.

    It might help to try a small “sanity check” backup, described here by Total Upkeep’s lead developer: https://youtu.be/fvC2oadm-8g

    It’s also worth mentioning that Cloudways is a “Managed” WordPress hosting provider, and often this type of hosting doesn’t allow backup storage. Although I couldn’t find any documentation about that from them, it’s worth checking with their Support team to see if some automated process is deleting the large .zip file.

    Thread Starter RT_PDX

    (@ronald2020)

    Hi Jesse!

    Thanks again! Okay, so i ran a sanity backup just to be sure. It took 3 seconds. I run much larger scripts on cloudways and as far as I know they don’t actively restrict. I have my own (bash) backup routine for all my sites (pretty much dump db add all files) but wanted to have a tool for end users so they can do one offs. Based on your feedback on the logs I took another route: Permissions! And sure enough, the backups are there. But surprisingly all permissions are reduced to only the php process owner and not may the usual groups. So it was all invisible to me.Same for FTP. A reset off the wordpress wp-content tree did the trick. I still get some chmod errors occasionally but I a manual backup works and the FTP upload as well. I am not sure if you guys are actively using chmods in your code (havent looked) but that may be a candidate for (optional) advanced setting? Thanks for all your help!

    Best, Ronald

    Plugin Support Jesse Owens

    (@jessecowens)

    Hi Ronald-

    Thanks for the update, that’s some great troubleshooting work!

    There are a few chmod’s in the code, but I’ve never seen this issue happen before. Normally I’d expect the files to be owned by the same user that owns the whole site, either your Linux user or something like a www-data that some server configurations use.

    Is the user that owns the PHP process unique to every backup, or is it the same every time? If it’s the same, you may be able to add that user to a group that includes read/write access to your other files.

    May I ask which platform you’re using at Cloudways? I.E. Digital Ocean, Linode, AWS, etc? I’d like to see if I can spin one up and replicate the issue so I can describe it to our developers and hopefully find a fix or, as you suggested, a configuration option.

    Thread Starter RT_PDX

    (@ronald2020)

    Hi Jesse,

    This one is a Digital Ocean server. It is the same application user for all backups done on the same site (cloudways ‘app’ in their lingo). You are right that typically there is a user (that runs PHP, nGINX etc) and the www-data group on the directories.

    What I noticed though is that with Total Upkeep the user is still there but the www-data group is set to zero rights. So, as ‘master user’ you don’t see the backup directory (boldgrid_backup…..).

    Hope this helps the team.

    Two handy links:

    https://support.cloudways.com/en/articles/5120743-difference-between-master-and-application-credentials

    https://support.cloudways.com/en/articles/5126387-how-can-i-reset-file-and-folder-permissions

    Best, Ronald

    Thread Starter RT_PDX

    (@ronald2020)

    Hi Jesse,

    I have been able to replicate the permission situation on Digital Ocean. When i move the backup directory to a different location (using the Upkeep interface) this is what gets created on the new location:

    drwx—— 3 thephpuser www-data 4096 Nov 29 16:33 boldgrid_backup_UNIQUECODE

    Upkeep overrides the default Digital Ocean permission set for www-data (drwxrwxr-x). I can imagine the idea behind it is extra security but I think it should be optional or at least be something one can turn off for specific hosting situations. Digital Ocean provides plenty of secure location where you can store files outside the content folders that are accessible by PHP.

    Thought this might help.

    Best, Ronald

    Plugin Support Jesse Owens

    (@jessecowens)

    Hi Ronald-

    Thanks for the information! I spun up a Cloudways VPS and I can see what you mean now.

    The good news is that for your end-users you mentioned, who mostly interact with the site via the dashboard, this shouldn’t worry them too much. I imagine the biggest problem is using SFTP to store your remote backups, since the SFTP user can’t access the directory and files.

    I went ahead and created a feature request to include those group permissions.

    In the meantime, I found that there is a filter you can use to make Total Upkeep change those permissions. I took the liberty of writing a little code snippet you can add to your sites, using a plugin like Code Snippets or in a child theme’s functions.php file:

    
    function bgsupport_backup_directory_perms( $files, $backup_dir ) {
    	$files[0]['chmod'] = 0770; //backup directory
    	$files[1]['chmod'] = 0770; //logs directory
    	return $files;
    }
    add_filter( 'boldgrid_backup_create_dir_config', 'bgsupport_backup_directory_perms', 2, 10);
    

    Be sure that the code snippet is active when you install and activate Total Upkeep, and this will enable you to have access as the group user.

    • This reply was modified 2 months ago by Jesse Owens. Reason: Forgot to specify to activate code first
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.