如何在wampserver中正确设置laravel框架? [英] How to setup laravel framework in wampserver properly?

查看:666
本文介绍了如何在wampserver中正确设置laravel框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习laravel.但是我在wampserver中安装框架有困难.我遵循了此说明,但出现错误.

I am studying laravel now. But I am having a difficulty in installing the framework in my wampserver. I followed this instruction but I am getting an error.

通过下载

Via Download

一旦安装了Composer,请下载最新版本的Laravel框架并将其内容提取到服务器上的目录中.接下来,在您的Laravel应用程序的根目录中,运行php composer.phar install(或composer install)命令来安装框架的所有依赖项.此过程需要在服务器上安装Git才能成功完成安装.

如果要更新Laravel框架,则可以发出php composer.phar update命令.

但是我要做的是我将laravel-master文件提取到了我的www文件夹中,然后还将composer.phar放入了laravel-master文件夹中.

But what I did is I extracted the laravel-master file in my www folder then I also put the composer.phar inside the laravel-master folder.

所以我有一个像这样的目录.

So I have a directory like this.

C:/wamp/www/laravel-master/

这是我的结构

- wamp
  - www
    - laravel
      - app (folder)
      - boostrap (folder)
      - public (folder)
      - .gitattributes
      - .gitignore
      - artisan
      - composer.json 
      - composer.phar
      - CONTRIBUTING.md
      - phpunit.xml
      - readme.md
      - server.php
      - upgrade.md

在命令提示符下,我通过以下方式安装composer.phar:

And in my command prompy I install the composer.phar by this way:

C:\wamp\www\laravel>php composer.phar install

但这是我的错误

安装依赖项 一套可安装的软件包无法满足您的要求.

Installing dependencies Your requirements could not be solved to an installable set of packages.

Problems:
        - The requested package "laravel/framework" with constraint [> 4.0.9999999.9999999, < 4.1.9999999.9999999] could not be found.
        - Problem caused by:
                - Installation of package "laravel/laravel" with constraint == 1.0.0.0 was requested. Satisfiable by packages [laravel/laravel-1.0.0.0].
                - Package "laravel/laravel-1.0.0.0" contains the rule laravel/laravel requires laravel/framework ([> 4.0.9999999.9999999, < 4.1.9999999.9999999]). No package satisfies this dependency.

我也尝试使用composer安装它,但是我也有一个错误.

I also tried to install it using composer but I have an error too.

C:\wamp\www\laravel>composer create-project laravel/laravel --prefer-dist
Installing laravel/laravel (v4.1.0)
  - Installing laravel/laravel (v4.1.0)



  [RuntimeException]
  You must enable the openssl extension to download files via https



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [version]

当我在apache和PHP中检查ssl时,它已启用.而且我也用phpinfo()来检查它

When I checked the ssl in my apache and PHP it is enable. And also I check it using the phpinfo()

请帮助我.我该怎么办?

Please help me guys. What should I do?

推荐答案

在WAMP上安装Laravel 4

必须在PHP配置中启用OpenSSL.

OpenSSL must be enabled in the PHP configuration.

在WAMP的PHP文件夹中编辑php.ini,例如:

Edit php.ini in your WAMP’s PHP folder, e.g.:

C:\wamp\bin\php\{Your.PHP.Version}\

其中{Your.PHP.Version}类似于php5.4.12.

您不应在其中编辑php.ini

C:\wamp\bin\apache\{Your.Apache.Version}\bin

其中{Your.Apache.Version}类似于Apache2.4.4,因为这不是Composer使用的文件.

where {Your.Apache.Version} is something like Apache2.4.4, because that is not the file that Composer uses.

找到下一行并删除其前面的分号(如果有的话)并保存文件.所以改变

Find the following line and remove its preceding semicolon (if there is one) and save the file. So change

;extension=php_openssl.dll

extension=php_openssl.dll

2.安装Composer

现在,我们需要安装Composer.这是一个依赖关系管理器,它将下载Laravel的最新版本以及Laravel依赖关系的特定版本,例如Doctrine和Symfony.

2. Install Composer

Now we need to install Composer. This is a dependency manager that will download the latest release of Laravel and specific versions of Laravel’s dependencies, such as Doctrine and Symfony.

2.1.从以下位置下载Composer Windows安装程序

2.1. Download the Composer Windows installer from

https://getcomposer.org/download/

2.2.运行安装程序.

2.2. Run the installer.

2.3.当它要求输入php.exe的位置时,将其指向WAMP的PHP文件夹中的可执行文件,例如:

2.3. When it asks for the location of php.exe, point it to the executable in your WAMP’s PHP folder, e.g.:

C:\wamp\bin\php\{Your.PHP.Version}\

2.4.完成安装.

2.5.打开命令行界面(cmd)并输入:

2.5. Open a command-line interface (cmd) and type:

composer

它应该返回选项列表.如果出现错误,请重新启动计算机,然后重试.

It should return a list of options. If you get an error, restart your computer and try again.

Composer现在已安装并添加到您的PATH环境变量中.这意味着您可以使用命令行界面从任何目录运行它.

Composer has now been installed and added to your PATH environment variable. This means you can run it from any directory using the command-line interface.

现在已经安装了Composer,Composer可以在您的系统上下载并安装Laravel.

Now that Composer has been installed, Composer can download and install Laravel on your system.

3.1.打开命令行界面(cmd).

3.1. Open a command-line interface (cmd).

3.2.进入要安装Laravel的目录.这通常是您的开发目录.在本教程中,我们将使用C:\wamp\www\laravel

3.2. Go to the directory in which you want to install Laravel. This is usually your development directory. In this tutorial, we’ll use C:\wamp\www\laravel

3.3.指示Composer将Laravel安装到项目目录中.我们使用项目名称myproject.

3.3. Instruct Composer to install Laravel into a project directory. We use project name myproject.

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

注意:

这会将Laravel安装在当前工作目录下名为myproject的子目录中.

Note:

This will install Laravel in a subdirectory named myproject under current working directory.

现在您的项目有一个正在运行的目录,例如

Now your project has a running directory like

C:\wamp\www\laravel\myproject\public\

请检查并接受接受的答案.

Please check as accepted answer and upvote.

这篇关于如何在wampserver中正确设置laravel框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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