1

Folks:

This is surely something real basic. I have not been able to create a database backup manually or when updating.

  • Mysqldump is installed.
  • I know the location of mysqldump (/usr/local/bin/mysqldump).
  • The log doesn't appear to reveal anything.

I have modified the .env file using the info from the MAMP database backup article (substituting the path for the MAMP one in the article). No joy.

According to the config docs, I need to change the PATH variable.

The question is: how do I do this? Specifically:

  • Where is this change made? Which file? general.php? .env? Elsewhere?
  • What is the syntax to make this work?
3
  • If you followed the MAMP guide, you'll need to make sure you are using MAMP’s PHP Executable your in Terminal
    – Oli
    Feb 27, 2020 at 8:19
  • I'm actually trying to do this on the staging server, not locally on MAMP. So I'm guessing things will have to be done a little differently.
    – Wonko
    Feb 27, 2020 at 12:42
  • When backups fail; you'll see an error in your craft/storage/web.log file which describes the error in detail. That would be useful info to post.
    – Derak
    May 13, 2021 at 21:46

2 Answers 2

1

The article was not quite right as it was for MAMP. What I did was add putenv("PATH={$_SERVER["PATH"]}:/usr/local/bin"), in the general.php file which resolved the issue. I didn't change the standard BACKUP_COMMAND in the .env file.

1

It's not just editing the .env file; you also need to modify the config to make use of those options; which is part two of that article you linked to.

You could also try adding a PATH variable to your .env which includes "/usr/local/bin" in it.

Update: The .env won't override an existing environment var by default. In most linux server setups this isn't a problem because the "www-data" or "apache" user doesn't have that set by default.

For MAMP, local dev or vagrant development; that path is likely set. If you want your .env settings to overwrite existing settings; change the web/index.php file to use Dotenv\Dotenv::create(CRAFT_BASE_PATH)->overload(); instead of Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.