php 如何安装和配置现有的 Laravel 项目?(Laravel 4)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29083268/
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
How I can install and configure an existing Laravel Project? (Laravel 4)
提问by Carlos Orellana
I need to install and configure an existing Laravel 4 project.
我需要安装和配置现有的 Laravel 4 项目。
I tried to do, but when I ran composer update
or composer install
a lot of issues appear.
我试过这样做,但是当我运行时composer update
还是composer install
出现了很多问题。
I have the database too (with data) so I ran the migration but doesn't work because the console show me an issue about the "table doesn't exist".
我也有数据库(带有数据),所以我运行了迁移但不起作用,因为控制台向我显示了一个关于“表不存在”的问题。
Can anyone tell me the complete process to configure the App?.
谁能告诉我配置应用程序的完整过程?
I mean, what its first, second and so and so because maybe in some step I made a mistake
我的意思是,它的第一个,第二个等等,因为也许在某些步骤中我犯了错误
回答by Alan Storm
To install and configure an existing project, you'd typically
要安装和配置现有项目,您通常会
Check out its source code
Run
composer install
Run
php artisan migrate
Check the
README
for specific instructions on installing 3rd party assets, or any additional steps you'd need to take
查看它的源代码
跑
composer install
跑
php artisan migrate
查看
README
有关安装 3rd 方资产的具体说明,或您需要采取的任何其他步骤
If the above creates errors, its either because of something in your environment (installing over an old project?) or some problem with the way the Laravel developer created their project.
如果上述内容产生错误,要么是因为您的环境中存在某些问题(安装在旧项目上?),要么是 Laravel 开发人员创建项目的方式存在问题。
回答by atxpunkrock
Carlos, when using an existing DB you'll need to check the migrations table to see which migrations have run successfully. Typically when taking over a laravel project setting up a new db and running the migrations against it is a good idea because you never know what hacks were made to the database outside the migration system. One small change can throw the entire system into a useless state because it's looking for a table or column that doesn't exist or has been modified. If you run the migrations against a bare db you can also figure out which tables were manually created (which could very well be your issue) outside the system and add them in as necessary. Cobbling things together after a previous developer is tedious, hopefully there is decent documentation.
Carlos,在使用现有数据库时,您需要检查迁移表以查看哪些迁移已成功运行。通常,在接管 laravel 项目时,设置新数据库并针对它运行迁移是一个好主意,因为您永远不知道在迁移系统之外对数据库进行了哪些黑客攻击。一个小的更改可能会使整个系统陷入无用状态,因为它正在寻找不存在或已被修改的表或列。如果您针对裸数据库运行迁移,您还可以确定哪些表是在系统外手动创建的(这很可能是您的问题),并根据需要添加它们。在前任开发人员之后将事情拼凑起来很乏味,希望有像样的文档。
回答by Divyesh Kanzariya
To install and configure an existing project, you'd typically check those things first :
要安装和配置现有项目,您通常首先要检查这些内容:
- You should goto
app/config/database.php
check file and verify username and password. - After check in Project Folder
vendor
folder andcomposer.json
file exist then remove it (that remove old configuration now we going to fresh configuration). - Then after back to command prompt and fire command
composer update
and that download some dependent file download. - Now Run
php artisan serve
- 您应该去
app/config/database.php
检查文件并验证用户名和密码。 - 检查项目文件
vendor
夹文件夹和composer.json
文件存在后,然后将其删除(删除旧配置现在我们要进行新配置)。 - 然后返回命令提示符并启动命令
composer update
并下载一些相关文件下载。 - 现在运行
php artisan serve
that tricks work for me last time when I migrate another host.
上次迁移另一台主机时,这些技巧对我有用。