Laravel Integrated Development Environment configuration

Source: Internet
Author: User
Tags php windows free ssh using git

The purpose of Laravel is to make the development experience more enjoyable and the development process simpler. The same is true of environmental construction.
Laravel Homestead is an officially released Vagrant package – a virtual machine – that provides a complete development environment. After the homestead configuration is complete, you do not need to configure any development tools in your on-premises environment, vagrant can take care of everything. Because it is a virtual machine, it does not cause any damage to the local system. At the same time, if a failure occurs, the virtual machine can be destroyed and rebuilt within a few minutes.
The homestead is cross-platform and can be run on WINDOWS,LINUX,MAC, which integrates all the software needed to develop laravel, such as NGINX,PHP5.6,MYSQL,POSTGRES,REDIS,MEMCACHED,HHVM.
This document is intended for homestead configuration runs under Windows environments.

1. Local Environment Settings 1.1 editor

It is recommended to use sublime text 3, which will have a separate document explaining how to use sublime text to efficiently develop PHP.

1.2 PHP

Running composer must have PHP, the latest version of PHP is recommended, the latest version of the 5.6.8. PHP Windows version is divided into 32-bit and 64-bit, 64-bit is still in the experimental phase, we choose a stable 32-bit version. It is divided into the thread safe and not thread safe version, in Web development we choose the not thread safe version, click here to download.
Note that the PHP version of Windows uses VC11 compilation, the system needs to have Visual C + + redistributable for Visual Studio x86 or x64, if the system does not install this package, click here Installation.
(1) Download the compressed package to the C Packing directory
(2) Configuration environment variable, add C:\php-5.6.8-nts-Win32-VC11-x86 to path.
(3) Modify the PHP configuration. Copy Php.ini-development to php.ini. Go to the comment before Extension=php_openssl.dll (composer required) Extension=php_mbstring.dll (laravel required). Locate ; extension_dir = "ext" , and modify it to Extension_dir = "C:\php-5.6.8-nts-Win32-VC11-x86\ext" .
(4) Open the console and run php-version to confirm that the PHP installation was successful.

c:\>php-versionphp 5.6.8 (CLI) (Built:apr 15:07:05) Copyright (c) 1997-2015 the PHP Group Zend Engine v2.6. 0, Copyright (c) 1998-2015 Zend Technologies
1.3 composer

Click here to download.
When the installation is complete, open the console and run to confirm that the composer --version installation was successful.

C:\>composer--versioncomposer version 1.0-dev (BC45D9185513575434021527D7756420E9F4B2CF) 2015-05-11 14:49:39

Composer default will be from http://packagist.org/ Download dependent packages, slower, can be used in the domestic mirror package instead of the source.
The global profile of the composer is located at C:\Users\benjamincao\AppData\Roaming\Composer\composer.json two faster, optional source configurations as follows:

{"Repositories": [{"Type": "Composer", "url": "https://toran.reimu.io/repo/packagist/" }, {"Packagist": false}]}

Or

{"Repositories": [{"Type": "Composer", "url": "Http://comproxy.cn/repo/packagist" }, {"Packagist": false}]}

When developing laravel projects, you can also add these domestic mirrors in the current project's Composer.json file to expedite updates to the package

1.4 Putty

Putty is a free SSH client that logs on to the Homestead virtual machine.
Click here to download.
Note If you are not using putty login, you can log in with Homestead ssh.

2. Homestead related Software Installation 2.1 vagrant

Vagrant is a virtual machine management tool. After you add a virtual machine, you can start mirroring the virtual machine and, if an error occurs, you can destroy the rebuild development environment at any time.

Download from here. Install directly after download.
Vagrant Installation Confirmation:

C:\>vagrant--versionvagrant 1.7.2
2.2 VirtualBox

VirtualBox is a provider of vagrant, after installation, Vagrant automatically starts when homestead is started.

Download from here and download the direct installation.

2.3 Homestead

Install directly with composer

Composer global require "laravel/homestead=~2.0"

Homestead will be installed inC:\Users\benjamincao\AppData\Roaming\Composer\vendor\laravel\homestead

2.4 Git

The purpose of installing GIT is to use the Git bash,homestead startup script that is just right under bash shell,windows using git bash.

Click here to download and then install. The installation is complete and ready to use.

3. Environment Start 3.1 Add Homestead image file using vagrant
Vagrant Box Add Laravel/homestead

Select VirtualBox as the provider.

The downloaded virtual machine, located inC:\Users\benjamincao\VirtualBox VMs\homestead
Note The virtual machine files are large, the download takes a long time, can be copied directly, added to vagrant.

Vagrant Box Add Laravel/homestead file:///d:/hbox/virtualbox.box
3.2 Generating RSA key

Login via SSH homestead need this.

Open git Bash, a relatively complete shell tool under Windows. You need to run this bash when you run the Homestead command.

Ssh-keygen.exe-t rsa-c "[Email protected]"
3.3 Configuring and starting Homestead
CD Appdata/roaming/composer/vendor/laravel/homestead/homestead Init

Generates a configuration file for homestead, located inC:\Users\benjamincao\.homestead\Homestead.yaml

Homestead Edit

Use the editor to open the created configuration file.

---# Virtual machine configuration. IP: "192.168.10.10" Memory:2048cpus:1provider:virtualboxauthorize: ~/.ssh/id_rsa.pubkeys:-~/.ssh/id_rsa# shared folder configuration, M The AP is a local folder, which is modified to be the local project folder, and to is the folder of the virtual machine, which is generally not required because of the Nginx configuration in Homestead. Folders:-Map: ~/code to:/home/vagrant/code# nginx configuration. The resolution of the domain name needs to be added to the local hosts. Sites:-Map:homestead.app to:/home/vagrant/code/public# mysql database configuration databases:-homestead# This doesn't know what to do with, guess is the environment Variable settings. Variables:-Key:app_env value:local

An example of an available configuration:

---ip:  "192.168.10.10" memory: 2048cpus: 1provider: virtualboxauthorize: c:/users/ benjamincao/.ssh/id_rsa.pubkeys:    - c:/users/benjamincao/.ssh/id_rsafolders:     - map: d:/workspace/erp/trunk      to: /home/ Vagrant/codesites:    - map: homestead.app      to : /home/vagrant/code/laravel/publicdatabases:    - homesteadvariables:     - key: APP_ENV      value: local#  Blackfire:#     - id: foo#       token:  bar#       client-id: foo#        client-token: bar# ports:#     - send: 93000#        to:&Nbsp;9300#     - send: 7777#       to:  777#       protocol: udp

Start Homestead

Homestead Up
3.4 Login Instructions

Logins primarily include SSH logins and MySQL logins.

3.4.1 SSH Login
Homestead SSH

When I use it here homestead ssh , there will always be a case of screen stuck, and we recommend using Putty login.
Initial User name password vagrant / vagrant

3.4 2 MySQL Password

homestead  / secret
root / secret

3.5 Advanced Configuration 3.5 Add a new website
    • Method One
      homestead.yamlAdd the site configuration in. Then homestead the directory to execute the command vagrant provision .
      vagrant provisionThis command is destructive and it will rebuild the database

    • Method Two
      After SSH login homestead, execute the serve command.

      Serve Domain.app/home/vagrant/code/path/to/public/directory 80
4. Detailed Command 4.1 Homestead command
Command explain
Up Start Homestead
Halt Stop Homestead
Init Create an initialized Homestead.yaml
Edit Edit Homestead.yaml
Suspend Hang Homestead
Resume Continue to hang the homestead
Ssh Login via SSH Homestead
Run Running commands on homestead via SSH
Status Get the status of Homestead
List List commands
Help Show Help for Commands
Provision Reconfigure Homestead
Destory Destroying Homestead
Update Update Homestead Image


In the installation of 1.3 composer, it is best to use the Circumvention tool to install after the wall, avoid always prompt "Connection Error [err_connection]: Unable to connect to getcomposer.org ..." Error





In the 2.3 homestead

When installing directly with composer, it is best to add the Composer.json

650) this.width=650; "alt=" ts.jpg "src=" Https://attachments.tower.im/tower/00500a88f25f4f1caf07ef1b41ef9bc6? Version=auto&filename=ts.jpg "/>

Avoid errors:

650) this.width=650; "alt=" error.jpg "src=" https://attachments.tower.im/tower/d3b2f8b3e45a4b84a9e7dafa2bd139c5? Version=auto&filename=error.jpg "/>



If homestead up, always prompt for the following error

650) this.width=650; "alt=" Clipboard image.png "src=" https://attachments.tower.im/tower/ 91b347ab1d48407eb0d490271403d70c?version=auto&filename=clipboard%20image.png "height=" 579 "width=" 652 "/>

WORKAROUND: Ensure that the CPU is enabled for virtualization Technology (VT) virtualization support. For Intel's CPU, press and hold the corresponding function key during boot to enter the BIOS, confirming that Intel Virtual technology is configured to enable.



Error: 650) this.width=650; "alt=" QQ picture 20151216095657.png "Src=" https://attachments.tower.im/tower/ 743b8eda4dfc482fa6be50015c71e768?version=auto&filename=qq%e5%9b%be%e7%89%8720151216095657.png "height=" 151 " Width= "654"/>

Perform the following steps:

1. Delete all files under C:\Users\Carnet motors\virtualbox VM directory

2, in CMD run the following command 650) this.width=650; "alt=" Clipboard image.png "src=" https://attachments.tower.im/tower/ 78f19d6a9f6946a2a5f748b31734c489?version=auto&filename=clipboard%20image.png "height=" 101 "width=" 638 "/>



The new version installation does not directly Homestead init but is used

Bash init.sh



~ Homestead upbringing Machine ' default ' to ' VirtualBox ' provider...==> default:box ' laravel/homestead ' could not be found. Attempting to find and install ... default:box provider:virtualbox default:box Version: <= 0.3.0

Open the C:\Users\Carnet motors\appdata\roaming\composer\vendor\laravel\homestead\scripts\homestead.rb file

config.vm.box_version = settings["version"] ||= "<= 0.3.0"Switchconfig.vm.box_version = settings["version"] ||= ">= 0.3.0"


Laravel Integrated Development Environment configuration

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.