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

查看:25
本文介绍了使用 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:xampphtdocslaravelCMSootstrap/../vendor/autoload.php):无法打开流:C:xampphtdocslaravelCMSootstrapautoload.php 中没有这样的文件或目录第 17 行

C:xampphtdocslaravelCMSootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:xampphtdocslaravelCMSootstrapautoload.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:xampphtdocs,然后根据您的需要运行上述第一个或第二个命令.

Remember to run the command within your desired directory for the project; in your case, for C:xampphtdocs, 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.

在您尝试解决 failed to open stream: 错误之前,请避免在上面的命令中使用带空格的文件夹名称(显然不是错误的根源).

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 服务器要求
failed to open stream: 错误通常发生在未启用 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天全站免登陆