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

CC BY-SA 4.0
2021-05-14T01:09:47.803Z
2021-05-14T01:09:47.803Z
Wonko
<p>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.</p>
<p>You could also try <a href="https://craftcms.stackexchange.com/questions/37349/configure-path-craft-uses-for-composer-and-php">adding a PATH variable to your .env</a> which includes &quot;/usr/local/bin&quot; in it.</p>
<p>Update:
<a href="https://github.com/vlucas/phpdotenv/tree/3.6#immutability" rel="nofollow noreferrer">The .env won't override an existing environment var by default.</a> In most linux server setups this isn't a problem because the &quot;www-data&quot; or &quot;apache&quot; user doesn't have that set by default.</p>
<p>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 <code>Dotenv\Dotenv::create(CRAFT_BASE_PATH)-&gt;overload();</code>
instead of
<code>Dotenv\Dotenv::create(CRAFT_BASE_PATH)-&gt;load();</code></p>

CC BY-SA 4.0
2021-05-13T21:45:44.173Z
2021-05-14T20:56:09.060Z
2021-05-14T20:56:09.060Z
Derak
<p>Folks:</p>

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

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

<p>I have modified the .env file using the info from the <a href="https://craftcms.com/guides/database-backups-in-craft-3-with-mamp" rel="nofollow noreferrer">MAMP database backup article</a> (substituting the path for the MAMP one in the article). No joy.</p>

<p>According to the <a href="https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#backupcommand" rel="nofollow noreferrer">config docs</a>, I need to change the PATH variable.</p>

<p>The question is: how do I do this? Specifically:</p>

<ul>
<li>Where is this change made? Which file? general.php? .env? Elsewhere?</li>
<li>What is the syntax to make this work?</li>
</ul>

CC BY-SA 4.0
2020-02-27T08:19:19.660Z
If you followed the MAMP guide, you'll need to make sure you are [using MAMP’s PHP Executable your in Terminal](https://craftcms.com/guides/mamp-with-composer-and-mysql-on-the-command-line#using-mAMPs-php-executable-in-terminal)
Oli
CC BY-SA 4.0
2020-02-27T12:42:16.743Z
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
CC BY-SA 4.0
2021-05-13T21:46:15.767Z
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
<craft3>
$PATH variable location for backups
# $PATH variable location for backups

(Asked by: username_0 on 2020-02-26)

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](https://craftcms.com/guides/database-backups-in-craft-3-with-mamp) (substituting the path for the MAMP one in the article). No joy.

According to the [config docs](https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#backupcommand), 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?

**Tags:** craft3

> **Comments:**
> **username_1**: If you followed the MAMP guide, you'll need to make sure you are [using MAMP’s PHP Executable your in Terminal](https://craftcms.com/guides/mamp-with-composer-and-mysql-on-the-command-line#using-mAMPs-php-executable-in-terminal)  
> **username_0**: 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.  
> **username_2**: 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.  

---

## 2 answers

### Answer by username_0 on 2021-05-14. Score: 1 | Accepted answer

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.


---

### Answer by username_2 on 2021-05-13. Score: 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](https://craftcms.stackexchange.com/questions/37349/configure-path-craft-uses-for-composer-and-php) which includes "/usr/local/bin" in it.

Update:
[The .env won't override an existing environment var by default.](https://github.com/vlucas/phpdotenv/tree/3.6#immutability) 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();`


---

