使用Composer安装Laravel [英] Install Laravel using Composer

查看:56
本文介绍了使用Composer安装Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Composer 安装Laravel,但是在运行以下命令之后

I'm trying to install Laravel using Composer, but after running the following command

composer create-project laravel/laravel cmsLaravel 5.2

指向我的 c/xampp/htddocs 目录,出现以下错误:

pointing to my c/xampp/htddocs directory, I get the error below:

C:\ xampp \ htdocs \ laravelCMS \ bootstrap/../vendor/autoload.php):无法打开流:C:\ xampp \ htdocs \ laravelCMS \ bootstrap \ autoload.php中没有此类文件或目录第17行

C:\xampp\htdocs\laravelCMS\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravelCMS\bootstrap\autoload.php on line 17

推荐答案

要使用composer安装Laravel,您要做的就是在终端中运行:

To install Laravel using composer, all you need to do is to run in your terminal is:

composer create-project --prefer-dist laravel/laravel blog

其中: blog 是包含新Laravel实例的文件夹的名称.

Where: blog is the name of the folder containing your new Laravel instance.

要直接在您选择的目录中安装Laravel(而不是如上所示,在其中的文件夹中),只需运行相同的命令,但是这次不带文件夹名称,如下所示:

To install Laravel directly within your chosen directory (not in a folder within it as demonstrated above), simply run the same command but this time without a folder name as in:

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

记住要在项目所需目录中运行命令;对于您的情况,对于 C:\ xampp \ htdocs \ ,然后根据需要运行上述第一个或第二个命令.

Remember to run the command within your desired directory for the project; in your case, for C:\xampp\htdocs\, then, run either the first or second command as above base on your needs.

这假定您已经按照建议在其网站上正确安装了Composer.>

This assumes you already have Composer properly installed as recommended on their website.

在尝试解决无法打开流的错误之前,请避免使用上面命令中的文件夹名称带有空格(显然不是错误的根源).

Before you try addressing your failed to open stream: error, do avoid having folder names with space(s) as in your command above (obviously not the source of the error).

确保您具有正确的Laravel服务器要求
无法打开流:错误通常在未启用OpenSSL PHP扩展时发生.

Make sure you have the correct Server Requirements for Laravel
the failed to open stream: error usually occur when the OpenSSL PHP Extension not enabled.

  • PHP> = 5.6.4
  • OpenSSL PHP扩展
  • PDO PHP扩展
  • Mbstring PHP扩展
  • Tokenizer PHP扩展
  • XML PHP扩展

启用所需的扩展名后,请务必记住重新启动服务器,然后运行以下命令:

After enabling the required extension(s), do remember to restart your server, then run the following command:

composer update

这篇关于使用Composer安装Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆