How To Fix “zsh: command not found: php”?


Are you having problems with the issue “zsh: command not found: php“? How to fix it? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now

How did “zsh: command not found: php” occur?

zsh: command not found: php

When you work with PHP, you may get the issue zsh: command not found: php. Don’t worry, we are here to provide you solutions in order to resolve your problem.

How to fix “zsh: command not found: php”?

To solve zsh error: command not found: PHP Error, you will need to install PHP in your profile. If you are using Brew, then use this command: brew install php. Now, your error should be fixed. The second solution is to set the php Path variable in your PATH variable if you already have php installed on your system. 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. Next, add the following pne to your .bashrcbashrc file: export PATH=$PATH:/usr/share/php/bin. Only Control + X to $700$ and then exit. Now you can Access PHP version with this Command. php –version. Your error must now be fixed.

Solution 1: Install PHP with Brew

Install PHP in your profile. If you use brew, then this command is required.

brew install php

Your mistake must now be fixed

Solution 2: Add php to your PATH

This error can be caused by PHP already installed on your system. 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 

Next, add the following line to your .bashrc file

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

Only Control + X to $7strongTag7$ and exit

This command will allow you to access PHP version.

php --version

Your error must be solved now

Final words

The above are useful solutions that can help you fix “zsh: command not found: php” problem, if you can’t solve it well. Please leave a message.



Source link