php 如何安装 Laravel 5.2

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

How to install Laravel 5.2

phplaravelcomposer-phplaravel-5.2

提问by Bhulawat Ajay

I am installing the Laravel framework in directory /var/html/www, using command

我正在目录中安装 Laravel 框架/var/html/www,使用命令

php composer.phar global require "laravel/installer"

It changes installation directory automatically, shown message is:

它会自动更改安装目录,显示的消息是:

Changed current directory to /home/.composer

将当前目录更改为 /home/.composer

What is the reason? Do I need to add any other command?

是什么原因?我需要添加任何其他命令吗?

回答by P??

This is because you installed the Laravel installer with global, which makes it globally available for all projects and installs it to /home/.composer.

这是因为您使用 安装了 Laravel 安装程序global,这使得它对所有项目全局可用并将其安装到/home/.composer.

This should be all right because it is only Laravel's installerand not a Laravel projectwhich should be created in a later step (see below) and this should be installed in your /var/html/wwwthen.

这应该没问题,因为它只是 Laravel 的安装程序,而不是应该在后面的步骤中创建的 Laravel项目(见下文),并且应该安装在你的/var/html/wwwthen 中。

Run the following command in your /var/html/wwwto create a new project (doesn't need Laravel installer):

在你的/var/html/www项目中运行以下命令来创建一个新项目(不需要 Laravel 安装程序):

composer create-project --prefer-dist laravel/laravel YourProjectName 5.2

or use the Laravel installer

或使用 Laravel 安装程序

laravel new YourProjectName

For more info how to install Laravel see the documentation here.

有关如何安装 Laravel 的更多信息,请参阅此处文档

回答by TinDoan

Let use

让使用

composer create-project --prefer-dist laravel/laravel project_name "5.2.*"

回答by Terabyte

1) change the permission of your directory to allow CRUD. Open Terminal and paste this command

1) 更改目录的权限以允许 CRUD。打开终端并粘贴此命令

sudo chmod -R o+rw /var/html/www

2) update the package manager cache by running:

2)通过运行更新包管理器缓存:

sudo apt-get update

3) cd to your directory to check if composer json does exist

3) cd 到您的目录以检查 composer json 是否确实存在

cd /var/html/www

and type

并输入

composer

4) To install composer in your directory run

4)在你的目录中安装composer运行

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

5) To test if it's installed run

5)要测试它是否安装运行

composer

6) Now install laravel 5.2 in your directory (/var/html/www)

6) 现在在您的目录 (/var/html/www) 中安装 laravel 5.2

composer create-project laravel/laravel ProjectName 5.2 --prefer-dist