Laravel PHP Command Not Found

Laravel PHP Command Not Found

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.

Laravel command not found. But it is added to my $PATH on Ubuntu

I'll write the answer here so you can close the question. As @geertjanknapen said in the comment if you can install your project the run

composer create-project laravel/laravel your-app-name
cd /your-app-name
php artisan serve

You must have a local server running also, once you have run php artisan serve then just go to http://127.0.0.1:8000/ and you'll see Laravel's home screen. (NOTE 8000 is the default port, so put yours there if you've changed it).

Laravel: command Not found

It is better to use $HOME instead of just ~.

In my .zshrc(I use zsh) I have it working this way

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

Make sure your terminal does actually use .bashrc and not maybe .bash_profile, if that is the case you should edit that file.
If you are using it from the VM, the user you log in with when you call vagrant ssh is vagrant, not root.

In addition, remember to source the file after the edit, or open a new terminal.

UPDATE

I see there are answers that put the $PATH after composer's path, so I thought I could tell you what I learned to be the difference.

It's not a random thing you can put whatever way you want. What you put after overwrites what comes before. You're gonna need to know it if you want to use packages that overwrites anything installed in paths that are already in PATH.

That means that if you have something installed on your system and you install a newer version of the package using composer, it will have the same command to start so if the composer path will not be after the system path, you'll have to reference the full path to the binary inside composer's vendor/bin to execute it.



Related Topics



Leave a reply



Submit