php Laravel - 工匠不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21882897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel - Artisan not working
提问by He Hui
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.
我安装了我自己的 Laravel 的新副本,并尝试运行php artisan list,它有效。
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.
现在,我有一个同事自己安装了 laravel 的副本,他将他的整个目录推送到 git 存储库。我将整个分支从存储库中拉出,并尝试运行php artisan list,但这次没有任何反应。我的意思是,从字面上看,什么都没有发生。
Any ideas as to why this is happening?
关于为什么会发生这种情况的任何想法?
回答by alexrussell
Generally speaking, the vendordirectory is not committed to VCS, as such, doing a clone on a standard Laravel app won't include all its dependencies.
一般来说,该vendor目录不会提交给 VCS,因此,在标准 Laravel 应用程序上进行克隆不会包含其所有依赖项。
Once you have cloned, doing composer install(or composer updateif you want the latest packages as a developer) will fetch the dependencies and allow your app to work.
克隆后,执行composer install(或者composer update如果您希望作为开发人员使用最新的软件包)将获取依赖项并允许您的应用程序运行。
回答by Dennis Braga
You need to run composer install, so the composer refresh all dependencies, artisan's begin on the middle. That should do the job!
您需要运行composer install,以便作曲家刷新所有依赖项,工匠从中间开始。那应该做的工作!
回答by Himanshu
My artisan was not working because i had the following lines in my routes.php
我的工匠没有工作,因为我的 routes.php 中有以下几行
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
exit();
}
I simply commented the exit(). So my code becomes as follows
我只是评论了 exit()。所以我的代码变成如下
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
// exit();
}
回答by pixelgoo
Just to point out some thing to anyone struggling with artisan, as this answer is 1st link in google to artisan CLI empty line:
只是向任何与工匠斗争的人指出一些事情,因为这个答案是谷歌中第一个链接到工匠 CLI 空行:
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:
每当发生错误时,它都会打印空行,即使您使用composer install. 它不会告诉你究竟出了什么问题。直到我将以下内容放入根目录中的 artisan 文件后,我才弄明白:
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).
这迫使工匠 CLI 显示错误消息,因此我能够修复它(我的 .env 文件已损坏)。
Hope this helps someone.
希望这可以帮助某人。
回答by Zia
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.1and DB_PORT=3306 to DB_PORT=8889
我在 8888 端口上运行 laravel 项目。在这种情况下,我将 .env 文件更新为: DB_HOST=localhost to DB_HOST=localhost toDB_HOST=127.0.0.1和 DB_PORT=3306 toDB_PORT=8889
Cleared cache by running artisan command and run the migrates:
通过运行 artisan 命令清除缓存并运行迁移:
php artisan config:clear
php artisan migrate
回答by Armanbacijcdvbjkodf
delete the your php at your system , and install it again
or if you run the app, move project folder at htdocsin
xampp folder and type address in browser , localhost/your project nameand your app is run on localhost
删除您系统中的 php,然后重新安装它,或者如果您运行该应用程序,请将项目文件夹移动htdocs到 xampp 文件夹中并在浏览器中输入地址,localhost/your project name您的应用程序将在本地主机上运行

