herd-community
herd-community copied to clipboard
[Bug]: Php not found when trying php -v from the git bash
Platform
Windows
Operating system version
Windows 11
System architecture
Intel (x86)
Herd Version
1.6.1
PHP Version
8.1, 8.2, 8.3
Bug description
When I try any php command from the git bash it shows
not found.
Steps to reproduce
- Install the Laravel herd on a Windows machine.
- Then install git bash
- Then try any PHP command
Relevant log output
$ php -v
bash: php: command not found
This can be a system environment variables setup issue. But I'm not sure why it's happened.
Note that I am not getting the same issue when I try from the Terminal / Powershes
You might need to add these aliases to your .bash_profile file
See https://herd.laravel.com/docs/windows/1/advanced-usage/command-line#git-bash
@mpociot oh yeah. It's awsome it's working now. Thanks, Dear Awesome tool from you guys
Step to solve
-
Add a ~/.bash_profilefile in ~/Users/{acount-name}/ || ~/.bash_profile not available in my directory
-
Paste all these lines
alias php="php.bat"
alias herd="herd.bat"
alias laravel="laravel.bat"
alias composer="composer.bat"
- close the git bash
- Open again and tried php -v
Navigate to the bin path of the "herd" folder within Application Support. Then, use the ls -la command to identify which version of PHP is linked to the "php" file.
If that version of PHP is missing, install it. This should resolve the issue I encountered where PHP was missing after installation.
You might need to add these aliases to your .bash_profile file
See https://herd.laravel.com/docs/windows/1/advanced-usage/command-line#git-bash
that's very helpful worked for me