1

I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like /opt/lampp/htdocs/learning-larvel/

Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.

Now, to create a new file for Laravel, when i open my Terminal and type laravel new xyz then it gives me a error which says bash: laravel: command not found

Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself. I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/

Any help would be extremely thankful.

15
  • what new file for laravel? if you have laravel installed, php artisan is the cli command to interact with it. Commented Dec 29, 2015 at 5:14
  • @lagbox I meant in General that if i type the command laravel then it shows me Command not found. The command laravel new file is command to make a New File through CLI which is what i saw in this video of Devdojo youtube.com/watch?v=--9I5wqXgUM Check the first 1 min of the Video. Commented Dec 29, 2015 at 5:20
  • you have to fix your composer issue first.. you should run it as php composer.phar ... Commented Dec 29, 2015 at 5:26
  • no that command creates a new project. have you downloaded the laravel installer ? Commented Dec 29, 2015 at 5:36
  • Also ensure to add composer to your PATH, bashrc is the best place Commented Dec 29, 2015 at 5:43

2 Answers 2

2

As the composer official getting started page points out:

There are in short, two ways to install Composer. Locally as part of your project, or globally as a system wide executable.

if you wanna do composer -- or laravel -- in command line, you wanna install them globally.

Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx https://laravel.com/docs/4.2#install-laravel

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks, i installed composer globally now. So when i type composer --version in my Terminal it gives me Version. But when i went to Laravel Documentation which you provided and i ran the command composer create-project laravel/laravel {directory} 4.2 --prefer-dist and it shows it got installed succesfully and then i ran laravel --version then it shows me again "Bash command Laravel not found". Any method to get over it please?
That's prob because laravel is still not installed globally. composer create-project is used to create new projects from an existing package. You should prob use composer global require "laravel/installer=~1.1". Also checkout: getcomposer.org/doc/03-cli.md#create-project
As per you told, i have ran the Command composer global require "laravel/installer=~1.1 as mentioned in those documentation, it fetched all the Repos/ files . But again, when i type simply laravel in my Terminal. It shows command not Found, so do you think, i should install it's PATH as Environmental Variable. ? Because i tried export PATH="$PATH:$HOME/.composer/vendor/bin" too in Bashrc . But problems is the same :(
Yeah, I would def check the environmental variable path. Also, this is mentioned in the laravel docs. "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system." I suggest you check again if your PATH is correct, and it's correctly set, by entering echo "$PATH". Also, to make these changes permanent, you should add that to your ~/.bash_profile file. echo 'export PATH=$PATH:~/.composer/vendor/bin' >> ~/.bash_profile
Then it's not correctly set. Try this: echo 'export PATH="$PATH:~/.composer/vendor/bin"' >> ~/.bashrc, after that you wanna reload .bashrc source ~/.bashrc. The output of echo $PATH should look something like this /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/web/bin:~/.composer/vendor/bin , with ~/.composer/vendor/bin in it
|
0

I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.