herd-community icon indicating copy to clipboard operation
herd-community copied to clipboard

[Bug]: Php not found when trying php -v from the git bash

Open AtiqurCode opened this issue 1 year ago • 4 comments

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 Screenshot 2024-05-16 220007 not found.

Steps to reproduce

  1. Install the Laravel herd on a Windows machine.
  2. Then install git bash
  3. Then try any PHP command

Relevant log output

$ php -v
bash: php: command not found

AtiqurCode avatar May 16 '24 16:05 AtiqurCode

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 Uploading Screenshot 2024-05-16 220400.png…

AtiqurCode avatar May 16 '24 16:05 AtiqurCode

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 avatar May 16 '24 16:05 mpociot

@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 Screenshot 2024-05-16 221934

AtiqurCode avatar May 16 '24 16:05 AtiqurCode

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.

amiralidev avatar May 18 '24 05:05 amiralidev

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

Mohamed-G2021 avatar Nov 26 '24 08:11 Mohamed-G2021