25

I'm aware of the other questions out there, but they are different to my situation.

I installed a fresh copy of my own laravel, and I tried running php artisan list, which works.

Now, I have a colleague who has installed a copy of laravel himself, and he pushes his entire directory onto a git repository. I pulled the entire branch off the repository, and tried running php artisan list, but nothing happens this time. I mean, literally, nothing happens.

Any ideas as to why this is happening?

Community
  • 1
  • 1
He Hui
  • 2,196
  • 4
  • 29
  • 46
  • 2
    Have you run `composer install` after cloning the repo? That said, I wouldn't expect **nothing** to happen if the error was as bad as being unable to load in files (though it could depend on your display_error settings). – alexrussell Feb 19 '14 at 14:15
  • UNIX/Windows/OSX? Are you pushing `composer.phar` too? – Sergiu Paraschiv Feb 19 '14 at 14:16
  • @Sergiu I'm using OSX. – He Hui Feb 19 '14 at 14:19
  • @Alexrussell I'm supposed to run composer install? Sorry I'm new to working with laravel/command line in php – He Hui Feb 19 '14 at 14:19
  • seems to work now after i run composer install. Is there any particular reason why? – He Hui Feb 19 '14 at 14:23
  • 1
    Yes. `composer install` downloads the dependencies you defined in `composer.json` in your `vendor` folder that you do not push to git. Artisan is part of the `laravel` package that's a dependency. – Sergiu Paraschiv Feb 19 '14 at 14:27
  • thanks. If you can add that as an answer, I'll accept it. – He Hui Feb 19 '14 at 14:51
  • Thanks @HeHui, I've added the answer below. As Dennis already got in with my answer after you said it was the reason I figured I'd give a little more info in my answer in order to still make it a better choice for acceptance. – alexrussell Feb 19 '14 at 15:18

7 Answers7

31

Generally speaking, the vendor directory is not committed to VCS, as such, doing a clone on a standard Laravel app won't include all its dependencies.

Once you have cloned, doing composer install (or composer update if you want the latest packages as a developer) will fetch the dependencies and allow your app to work.

alexrussell
  • 13,856
  • 5
  • 38
  • 49
12

You need to run composer install, so the composer refresh all dependencies, artisan's begin on the middle. That should do the job!

Dennis Braga
  • 1,448
  • 3
  • 20
  • 40
7

My artisan was not working because i had the following lines in my routes.php

if(!isset($_SESSION['c_id'])) {
    header("Location: /login_page.php");
    exit();
}

I simply commented the exit(). So my code becomes as follows

if(!isset($_SESSION['c_id'])) {
    header("Location: /login_page.php");
//    exit();
}
Himanshu
  • 180
  • 1
  • 7
3

Just to point out some thing to anyone struggling with artisan, as this answer is 1st link in google to artisan CLI empty line:

It will print blank line whenever some error happens, even if you have all dependencies installed with composer install. And it won't tell you exactly what is wrong. I couldn't figure it out until I put into artisan file in the root directory this:

ini_set('display_errors',1);
error_reporting(-1);

That forced artisan CLI to show error message and therefore I was able to fix it (my .env file was broken).

Hope this helps someone.

1

Environment file is not usually pushed to repo.

Make sure you'd also put ".env" file at root path.

0

In my case problem was to connect artisan with database (migrates) i.e. the command

$php artisan migrate

was not working.

I was running laravel project on 8888 port. In this case I updated .env file as: DB_HOST=localhost to DB_HOST=localhost to DB_HOST=127.0.0.1 and DB_PORT=3306 to DB_PORT=8889

Cleared cache by running artisan command and run the migrates:

php artisan config:clear
php artisan migrate
Zia
  • 213
  • 1
  • 8
-3

delete the your php at your system , and install it again or if you run the app, move project folder at htdocs in xampp folder and type address in browser , localhost/your project name and your app is run on localhost