close

[Solved] zsh: command not found: php

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to get my php version With php -v command, But I am facing following error in my zsh terminal zsh: command not found: php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How zsh: command not found: php Error Occurs ?

I am trying to get my php version With php -v command, But I am facing following error in my zsh terminal.

zsh: command not found: php

How To Solve zsh: command not found: php Error ?

  1. How To Solve zsh: command not found: php Error ?

    To Solve zsh: command not found: php Error You just need to install php in your profile If you are using brew then just use this command: brew install php Now, Your error must be solved. Second solution is If you have already php installed in your system and You are facing this error then you must set php Path to the PATH variable. You Just need to fix it in the .bashrc file. First of all Open Your terminal and Just edit your .bashrc file with this command: nano ~/.bashrc. Then add this line in the .bashrc file: export PATH=$PATH:/usr/share/php/bin. Just Control + X to Save and exit. Now you can Access PHP version with this Command. php –version. Now, Your Error Must Be solved.

  2. zsh: command not found: php

    To Solve zsh: command not found: php Error You just need to install php in your profile If you are using brew then just use this command: brew install php Now, Your error must be solved. Second solution is If you have already php installed in your system and You are facing this error then you must set php Path to the PATH variable. You Just need to fix it in the .bashrc file. First of all Open Your terminal and Just edit your .bashrc file with this command: nano ~/.bashrc. Then add this line in the .bashrc file: export PATH=$PATH:/usr/share/php/bin. Just Control + X to Save and exit. Now you can Access PHP version with this Command. php –version. Now, Your Error Must Be solved.

Solution 1: install php with brew

You just need to install php in your profile If you are using brew then just use this command.

brew install php

Now, Your error must be solved.

Solution 2: add php to PATH

If you have already php installed in your system and You are facing this error then you must set php Path to the PATH variable. You Just need to fix it in the .bashrc file.

First of all Open Your terminal and Just edit your .bashrc file with this command.

nano ~/.bashrc 

Then add this line in the .bashrc file:

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

Just Control + X to Save and exit.

Now you can Access PHP version with this Command.

php --version

Now, Your Error Must Be solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment