Laravel PHP Command Not Found

Add the following to .bashrc file (not .bash_profile).

export PATH="~/.composer/vendor/bin:$PATH" 

at the end of the file and then in terminal run source ~/.bashrc

To verify that:

echo $PATH

(Restart the terminal, Check & Confirm the path is there)

Run the laravel command!

Note: For Ubuntu 16 and above use below:

export PATH="~/.config/composer/vendor/bin:$PATH" 

Ok, I did that and it works:

nano ~/.bash_profile 

And paste

export PATH=~/.composer/vendor/bin:$PATH

do source ~/.bash_profile and enjoy ;)

Important: If you want to know the difference between bash_profile and bashrc please check this link

Note: For Ubuntu 16.04 running laravel 5.1, the path is: ~/.config/composer/vendor/bin

On other platforms: To check where your Composer global directory is, run composer global about. Add /vendor/bin to the directory that gets listed after "Changed current directory to ..." to get the path you should add to your PATH.


When using MacBook, refer to the snippets below;

For zsh:

echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >>  ~/.zshrc
source ~/.zshrc

For Bash:

echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Tags:

Php

Bash

Laravel