克隆后设置 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
Setup Laravel project after cloning
提问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
- run
composer install
to generate depedencies in vendor folder - change
.env.example
to.env
- run
php artisan key:generate
- configure
.env
- 运行
composer install
以在供应商文件夹中生成依赖项 - 更改
.env.example
为.env
- 跑
php artisan key:generate
- 配置
.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 repogit clone <l_repo>
1.克隆repogit clone <l_repo>
2. go into the repocd l_repo
2.进入repocd l_repo
3. install require packagescomposer install
3.安装需要的包composer install
4. generate the laravel project keyphp artisan key:generate
4.生成laravel项目密钥php artisan key:generate
5. migrate and seed at the same timephp 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.iniupload_max_filesize = 4G
post_max_size = $4G
7.修改php.ini文件上传限制upload_max_filesize = 4G
post_max_size = $4G
8. Link with storagephp artisan storage:link
8. 与存储链接php artisan storage:link
9. start the serverphp 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 install
to get all the packages. It will download all the required dependencies to run the project and also will create an .env
file 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.dev
is 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