Installing Laravel 5.1.X in Windows

Source: Internet
Author: User

1. Preparation 1.1 PHP integrated environment

Here we are using XAMPP, the latest version: PHP version 5.5.27 (32-bit) | PHP version 5.6.11 (32-bit). These two versions of XAMPP no longer support the Windows XP operating system, which means you need a later version of the Windows operating system.

Note: Because Laravel 5.1 requires a PHP 5.5.9+ (included) version, select the appropriate xampp for the PHP version.

1.2 Installing composer

Latest version of Windows Composer Download: Composer-setup.exe.

After the installation is complete, if the installation/update of the composer installation package is slow, you can configure the installation and upgrade using the domestic image for package dependencies, refer to this article "composer China Full-volume mirror".

PS: Want to composer installation slow as cattle, an update takes a few hours, but now obviously feel a lot faster, do not need to set up a domestic mirror, can also operate smoothly.

1.3 Configuring the System path

To use commands in the console composer , you need to configure the directory where the composer and PHP executables (. Exe/.bat) are located in the system environment variable path. PHP corresponding to the php.exe xampp installation directory, composer the corresponding composer.bat file directory is the default C:\ProgramData\ComposerSetup\bin . Don't repeat it here.

1.4 Other requirements

PHP Essentials Extensions: OpenSSL, PDO, mbstring, Tokenizer. Check to see if these PHP extensions are installed and need to be installed if they are not installed.

Restart XAMPP After the installation is complete.

2. Use composer to install Laravel

After the preparation has been done, the new Laravel application is officially installed. First we install Laravel directly through composer.

Enter the folder for the XAMPP installation directory htdocs :

Cd/path/to/xampp/htdocs

Under this directory, execute the following composer command:

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

You can install a new Laravel application with a directory name in the directory, laravel if you want to specify a custom installation directory name, for example laravelapp , use the following command:

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

If the installation process error:

[RuntimeException] Could not load Package Classpreloader/classpreloader in http://packagist.org: [unexpectedvalueexception] Could not parse Version constraint ^1.2.2:invalid version string "^1.2.2"

Indicates that the composer needs to be updated:

Composer Self-update

Execute the installation command again after the update is complete.

It takes a while for the installation to complete, and after the installation is complete, you can http://localhost/laravelapp/public access the newly installed Laravel app in the browser:

Of course you can also configure the virtual host to access the application through the domain name, for example, here I configure the virtual host domain name is http://laravel.app :

The corresponding Apache httpd-vhosts.conf configuration is as follows:

<virtualhost *:80>    documentroot "e:/xampp/htdocs/laravelapp/public"    ServerName laravel.app    Errorlog "Logs/laravelapp-error.log"    customlog "Logs/laravelapp-access.log" common</virtualhost>

Note: You will need to DocumentRoot set up your own Laravel installation directory in your own configuration file.

3. Install the laravel using the Laravel installer

First install the Laravel installer with the following command:

composer global require "laravel/installer=~1.1"

Make sure the directory where the Laravel.bat is located (by default C:\Users\用户名\AppData\Roaming\Composer\vendor\bin , replace "user name" with your current user name) in the system path, otherwise you will not be able to invoke the laravel command.

Next, you can install a new Laravel application with the following command, for example, if we create an laravelapp app named:

laravel new laravelapp

Using this method to create a Laravel app is much faster than using the composer installation directly:

You can also use the configuration above to http://laravel.app access the Laravel application that you just installed:

4, using Laravel one-click installation package

If you want to skip the tedious process of installing with the composer or Laravel installer, and use a ready-made, installed-dependent laravel package, click on the download link below to download the 5.1.4 version of the Laravel package:

Laravel 5.1.4 Version One-click installation package

In fact, it is the Laravel application that we generated through the above two ways to make a package. Tested and valid:

Note: For security reasons, after downloading the one-click installation package, it is best to go to the app directory execution php artisan key:generate command to regenerate the app App_key.

Installing Laravel 5.1.X in Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.