Reputation: 3545
I am using git-bash on windows, but unfortunately it seems I have a configuration issue. I am trying to use the export function to set environment variables, like so:
$ export php='/c/xampp/php/php.exe'
$ php -v
bash: php: command not found
This is also the case after a restart of git-bash.
Using the alias function works:
$ alias php='/c/xampp/php/php.exe'
$ php -v
PHP 7.4.7 (cli) (built: Jun 9 2020 13:36:15) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
I've also tried to register the environment variables directly in the .bash_profile
-configuration-file, which I assume is the one located under C:/Users/username
, but that does not work either.
As of now, I assume if haven't setup git correctly or made some stupid mistake. Any hint what I am missing would be very much appreciated.
Upvotes: 0
Views: 1013
Reputation: 225238
Variables are referenced with $
, and you don’t need to export
them unless you want them to become environment variables of spawned programs.
php=/c/xampp/php/php.exe
$php -v
You should continue using alias
for this, though – that’s what it’s for! – or extend your $PATH
instead:
PATH="$PATH:/c/xampp/php"
Upvotes: 2