'zsh is not finding my php executable

I'm using zsh on my Ubuntu VPS.

When I try to find version

php -v zsh: command not found: php

and my php executable somehow got into

whereis php php: /usr/share/php

How can I point it to right path?



Solution 1:[1]

export PATH=$PATH:/usr/share/php/bin

Add this to your .zshrc (assuming /usr/share/php/bin is the directory in which the php binary lives).

Solution 2:[2]

Ho you have to over write all commands to zsh

try this

PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH

Solution 3:[3]

Just reinstall PHP and overwrite any previous installation with this:

brew link --overwrite php

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 Hamel Kothari
Solution 2 Mohamed Nizar
Solution 3 Skatox