如何在wampserver中正确设置laravel框架?

Jer*_*lle 27 php laravel

我现在正在学习laravel.但我在我的wampserver中安装框架时遇到了困难.我遵循了这条指令,但是我收到了一个错误.

通过下载

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

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

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

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

C:/瓦帕/网络/ laravel主/

这是我的结构

- 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
Run Code Online (Sandbox Code Playgroud)

在我的命令提示我通过这种方式安装composer.phar:

C:\wamp\www\laravel>php composer.phar install
Run Code Online (Sandbox Code Playgroud)

但这是我的错误

安装依赖项无法将您的需求解决为可安装的软件包集.

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.
Run Code Online (Sandbox Code Playgroud)

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

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]
Run Code Online (Sandbox Code Playgroud)

当我在我的apache和PHP中检查ssl时启用它.我也用phpinfo()检查它

请帮帮我们.我该怎么办?

Rav*_*xan 75

在WAMP上安装Laravel 4

1.启用OpenSSL

必须在PHP配置中启用OpenSSL.

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

C:\wamp\bin\php\{Your.PHP.Version}\
Run Code Online (Sandbox Code Playgroud)

在哪里{Your.PHP.Version}是这样的php5.4.12.

注意:

你不应该编辑php.ini内部

C:\wamp\bin\apache\{Your.Apache.Version}\bin
Run Code Online (Sandbox Code Playgroud)

这里{Your.Apache.Version}是一样的东西Apache2.4.4,因为那是不是作曲家使用该文件.

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

;extension=php_openssl.dll
Run Code Online (Sandbox Code Playgroud)

extension=php_openssl.dll
Run Code Online (Sandbox Code Playgroud)

2.安装Composer

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

2.1.从中下载Composer Windows安装程序

https://getcomposer.org/download/
Run Code Online (Sandbox Code Playgroud)

2.2.运行安装程序.

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

C:\wamp\bin\php\{Your.PHP.Version}\
Run Code Online (Sandbox Code Playgroud)

2.4.完成安装.

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

composer
Run Code Online (Sandbox Code Playgroud)

它应该返回一个选项列表.如果出现错误,请重新启动计算机并再试一次.

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

3.安装Laravel

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

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

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

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

composer create-project laravel/laravel myproject --prefer-dist
Run Code Online (Sandbox Code Playgroud)

注意:

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

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

C:\wamp\www\laravel\myproject\public\
Run Code Online (Sandbox Code Playgroud)

请检查接受的答案和upvote.

  • 即使在一年之后,是的,这对我安装 laravel 5 有很大帮助 (2认同)

Fer*_*yan 9

我正在使用此过程来设置laravel以使用wamp服务器并且它可以正常工作

1.you have to put laravel in  C:\wamp\www folder

2.then u have to go application/config ....open application.php and change url='';

3.change key='K3u4UsHKh7AjSitP9VLTMtbd1mjvdzmQ'

4.then u have to go int C:\wamp\bin\apache\Apache2.2.21\conf\extra  folder then
  open <<=== httpd-vhosts.conf ===>> file and paste below this line into that folder

<VirtualHost *:80>
    DocumentRoot C:/wamp/www/laravel/public
    ServerName xxxxx.dev
</VirtualHost>


5.then go   C:\Windows\System32\drivers\etc  folder and open <<=== hosts ===>> file then paste
 127.0.0.1       xxxxx.dev

6.then go C:\wamp\www\laravel\public folder ...and then open a.htaccess ..then paste 
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php [L]
7.Then u have to go >> C:\wamp\bin\apache\apache2.2.22\conf <<  this directory & open httpd.conf & comment out this line

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

8.then go wamp server .....start it ..and click rewrite mode in apache->apache module..then restart wamp server

9.then go ur browser and write xxxxx.dev/docs  ...
Run Code Online (Sandbox Code Playgroud)

我希望这可以帮助你!