I have installed on Windows 10, both php 7.4 and php 8.1 in different folders PHP7 and PHP8. I have put C:/PHP7 in the PATH (environment variable) and now when I type php in the terminal (CMD, PowerShell and Git Bash) is running php7.
For php8 I have made a custom command php8 by creating a php8.cmd file with this simple content:
"C:/PHP8/php.exe" %*
I have placed the folder where the file is located in the PATH.
All good. Now when I type php8 in Command Line or PowerShell is running php 8. But if i type php8 in the Git Bash it says bash: php8: command not found
Somehow the Git Bash for Windows does not see the new custom command. I am not sure if I need to make a separate .sh file in which to put the equivalent content from the php8.cmd file or if is just a problem of configuring Git Bash to see the php8.cmd file.
Also I do not know what is the equivalent of "C:/PHP8/php.exe" %*
in shell script.
Can anyone help with this?
I am doing this because I have an application based on Laravel8 (using php 7.4) and I want to switch it on Laravel 9 (which requires php 8). So I want to start a separate folder where to test the application using Laravel 9 (to see which changes I need to make to the code base or which dependencies need to upgrade). In my PhpStorm I am using Git Bash as the integrated terminal, and that's why I want that custom command php8 to work in Git Bash, too.
Many thanks!