Laravel - Artisan not working

若如初见. 提交于 2019-12-09 05:08:56

问题


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?


回答1:


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.




回答2:


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




回答3:


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();
}



回答4:


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.




回答5:


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


来源:https://stackoverflow.com/questions/21882897/laravel-artisan-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!