克隆后设置 Laravel 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38437072/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:10:52  来源:igfitidea点击:

Setup Laravel project after cloning

phplaravel

提问by Coffee

So I have just cloned big repo with Laravel project, for the moment this folder (lets call it /var/www/project) does not have vendor folder, .env file, autoload files etc.

所以我刚刚用 Laravel 项目克隆了大仓库,目前这个文件夹(我们称之为 /var/www/project)没有供应商文件夹、.env 文件、自动加载文件等。

Is there some kind of detailed united tutorial with all the steps what should I do next? Install composer (it is already installed on my computer, I have other working projects), generate autoload files and vendors?

是否有某种详细的统一教程以及所有步骤我接下来应该做什么?安装composer(它已经安装在我的电脑上,我有其他工作项目),生成自动加载文件和供应商?

Which commands should I run in my console (I have Ubuntu 14.04) to make this folder a working virtual host? Or could someone be so kind to give me all the instructions?

我应该在我的控制台(我有 Ubuntu 14.04)中运行哪些命令来使这个文件夹成为一个工作的虚拟主机?或者有人可以给我所有的指示吗?

回答by Raymond Cheng

  1. run composer installto generate depedencies in vendor folder
  2. change .env.exampleto .env
  3. run php artisan key:generate
  4. configure .env
  1. 运行composer install以在供应商文件夹中生成依赖项
  2. 更改.env.example.env
  3. php artisan key:generate
  4. 配置 .env

basiclly you need do these things, more info you should check docs

基本上你需要做这些事情,更多信息你应该检查文档

回答by Sayka

Windows

视窗

Go to the project folder
Shift+Right Click -> Open command window here

转到项目文件夹
Shift+右键单击 -> 在此处打开命令窗口

Mac

苹果电脑

Open Terminal, Type "cd " (with a space)
From finder, Drag the project folder
Press Enter to go inside the project folder

打开终端,输入“cd”(带空格)
从finder中,拖动项目文件夹
按Enter进入项目文件夹

Compose

撰写

composer install

Generate Key

生成密钥

php artisan key:generate

Setup Database

设置数据库

Open the file .env
(Assuming wamp or xampp)
Edit values to match your database
Add empty database using phpmyadmin
Include that name in the DB_DATABASE

打开文件.env
(假设 wamp 或 xampp)
编辑值以匹配您的
数据库 使用 phpmyadmin 添加空数据库
在 DB_DATABASE 中包含该名称

DB_HOST=localhost
DB_DATABASE=students_data
DB_USERNAME=root
DB_PASSWORD=

Get Tables

获取表

php artisan migrate

Get default/initial/dummy table values

获取默认/初始/虚拟表值

php artisan db:seed

Run the project

运行项目

php artisan serve

回答by kamalesh biswas

1. clone the repo
git clone <l_repo>

1.克隆repo
git clone <l_repo>

2. go into the repo
cd l_repo

2.进入repo
cd l_repo

3. install require packages
composer install

3.安装需要的包
composer install

4. generate the laravel project key
php artisan key:generate

4.生成laravel项目密钥
php artisan key:generate

5. migrate and seed at the same time
php artisan migrate:fresh --seed

5. 同时迁移和播种
php artisan migrate:fresh --seed

6A.convert ".env.example" to ".env"

6A。将“.env.example”转换为“.env”

6B.change the 'database name' & 'username' & 'password'
DB_HOST=localhost DB_DATABASE=own_databse_name DB_USERNAME=root DB_PASSWORD=

6B。更改“数据库名称”和“用户名”和“密码”
DB_HOST=localhost DB_DATABASE=own_databse_name DB_USERNAME=root DB_PASSWORD=

7. Change the file upload limit for php.ini
upload_max_filesize = 4G post_max_size = $4G

7.修改php.ini文件上传限制
upload_max_filesize = 4G post_max_size = $4G

8. Link with storage
php artisan storage:link

8. 与存储链接
php artisan storage:link

9. start the server
php artisan serve

9.启动服务器
php artisan serve

回答by Sitethief

Follow the Install Laravel documentation: https://laravel.com/docs/5.2#installation

按照安装 Laravel 文档进行操作:https://laravel.com/docs/5.2#installation

回答by Muhammad Sumon Molla Selim

First of all, if there's no vendor folder - you will need to run composer installto get all the packages. It will download all the required dependencies to run the project and also will create an .envfile for local development starter.

首先,如果没有供应商文件夹 - 您将需要运行composer install以获取所有包。它将下载运行项目所需的所有依赖项,并将.env为本地开发启动器创建一个文件。

To configure virtual host in apache, run the following command:

要在 中配置虚拟主机apache,请运行以下命令:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.dev.conf

Here example.devis a sample virtual host name. Change it accordingly. Now edit it:

example.dev是一个示例虚拟主机名。相应地更改它。现在编辑它:

sudo nano /etc/apache2/sites-available/example.dev.conf

Here's an example contents for this file:

以下是此文件的示例内容:

<VirtualHost *:80>
    ServerAdmin admin@localhost
    ServerName example.dev
    ServerAlias www.example.dev
    DocumentRoot /var/www/project/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Then you will need to run the following commands to enable virtual host:

然后你需要运行以下命令来启用虚拟主机:

sudo a2ensite example.dev.conf
sudo service apache2 restart