'macos - Command source fix a php but broke other paths?
I want to have a php permissions on my terminal, but right now, if I type:
php -v as a result I got: zsh: command not found: php, interesting is next.
Without the next command I have a flutter path, for example, to run flutter doctor, but if I run command source ~/.bash_profile as a result I got a version of PHP, and everything it’s ok, but my path for flutter (as an example) is broken.
PHP 7.4.26 (cli) (built: Nov 22 2021 01:21:25) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
...
zsh: command not found: flutter
When I reset my PC, must run the source ~/.bash_profile command to be able to use PHP.
Solution 1:[1]
From your description, the probable cause of your issue might be associated with setting path in your shell. Your $PATH in ZSH might be overwritten (not appended) during the source ~/.bash_profile, hence making the php available and not the flutter.
Make sure PATH is set correctly in ZSH and BASH using the below format.
export PATH=$PATH:"your_directory"
or
export PATH="your_directory":$PATH
If $PATH is not present, then this is causing your issue. Verify this in your .bash_profile.
As pointed out in comment by OstoneO, the content of ~/.zshrc and ~/.bash_profile will be relevant to pinpoint the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | j23 |
