Configuring the Laravel development environment under Windows

Source: Internet
Author: User
Tags php framework

1, because there is a little php basis, so very much want to go further, the choice is said to be the most popular in the foreign PHP framework to learn, laravel framework, the official online introduction is for the arts, from the knowledge and some forums to see, laravel learning is not simple, the first configuration problems, stumped a lot of beginners.

Like all the beginners, I took a long time to configure the Laravel configuration to complete. Talk less, just start talking about my configuration experience, I choose the simplest, do not use composer to install, but directly use the official network has inherited the installation package to install,

Http://down.golaravel.com/laravel/laravel-v5.2.15.zip, you can download it yourself. After downloading the laravel5.2, put Laravel's decompression file into E:\server\laravel.

2, the php7.0 configuration

Here I choose is php7.0, because laravel to PHP version of the higher requirements, specific requirements please see https://laravel-china.org/docs/5.1/installation, first download php7.0, I choose to download a non-thread-safe 32-bit version of http://windows.php.net/downloads/releases/ Php-7.1.0-nts-win32-vc14-x86.zip, decompression can be used, I put the extracted files into the E:\wnmp\php, copy a php.ini-development, and change it to php.ini. With sublime open php.ini Open, OpenSSL php extension,pdo php extension,mbstring php Extension These three extensions, support MySQL also need to open PDO and mysqli extensions. Locate the Extension_dir, and change it to Extension_dir = "./ext" here refers to PHP's extended storage directory. Find Gi.fix_pathinfo=1, remove the previous number, here is the PHP CGI settings.

3. nginx1.11.6 Configuration

Nginx download page http://nginx.org/en/download.html, I downloaded the version of 1.11.6, after the download is complete, the Nginx decompression into the E:\wnmp\nginx, Then open the Nginx configuration file nginx.conf

Find the following line of code

Location/{
Root html; #这里是站点的根目录
Index index.html index.htm;
}

The revision was changed to

Location/{
Root E:/erver/laravel/public; #这里是laravel的存放文件目录
Index index index.html index.htm index.php; #这里是请求时首先加载的文件
Try_files $uri $uri//index.php?query_string; #去掉index. PHP, beautify URLs
}

Find Location ~ \.php$, remove the previous # and change to the following content

Location ~ \.php$ {
Root E:\server\laravel\public; #laravel的文件目录
Fastcgi_pass 127.0.0.1:9000; #php的端口号
Fastcgi_index index.php; #php的索引
Fastcgi_param script_filename $document _root$fastcgi_script_name; #指到前面设置的路径
Include Fastcgi_params;
}

4. Make PHP and Nginx startup files

First download Runhiddenconsole, for Http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip. After extracting the files, put the RunHiddenConsole.exe in the Nginx folder.

Then create the script, named "Start_nginx.bat," and we'll edit it in sublime.


@echo off
Inactive under REM Windows
REM Set php_fcgi_children=5

REM maximum number of requests processed per process, or set to Windows environment variable
Set php_fcgi_max_requests=1000

echo Starting PHP FastCGI ...
Runhiddenconsole e:/wnmp/php/php-cgi.exe-b 127.0.0.1:9000-c E:/wnmp/php/php.ini

Echo Starting Nginx ...
Runhiddenconsole e:/wnmp/nginx/nginx.exe-p E:/wnmp/nginx

Create another script named Stop_nginx.bat to close Nginx


@echo off
echo Stopping Nginx ...
taskkill/f/im nginx.exe > nul
echo Stopping PHP FastCGI ...
taskkill/f/im php-cgi.exe > nul
Exit

5. Start Laravel

Locate the folder E:\wnmp\nginx, click

Start Nginx and PHP, open the browser, enter localhost, and see

6. Add a route

Use sublime to open the Laravel code,

Find routes.php, add a test route

Route::get (' demo ', function () {
Return "Hello World";
});

Open Browser, enter

Configuring the Laravel development environment under Windows

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.