MacOS installation configuration Laravel

basic introduction:

Laravel is a free, open source Web framework written in PHP. It was created by the Taylor Otwell, follow the MVC development methodology.

As of March 2015, Laravel is considered one of the most popular PHP-based framework of.

In this tutorial, we will install Laravel on MacOS.


 surroundings:

  1. MacOS
  2. XAMPP
  3. PHP >= 7.0.0
  4. OpenSSL PHP Extension
  5. PDO PHP Extension
  6. Mbstring PHP Extension
  7. Tokenizer PHP Extension
  8. XML PHP Extension
  9. Composer

installation steps:

1. Make sure the Composer, run the composer command to view the current version

 

 2. composer install Laravel

$ composer global require "laravel/installer"  

 

3. Modify the  bash profile, add environment variables

Since the next command is directly laravel command, it needs to be written into the path laravel global environment variable

open a file

$ vim ~/.bash_profile  

Add the following path to the file

$ export PATH=~/.composer/vendor/bin:$PATH  

And then run the source command reload configuration

$ source ~/.bash_profile  

 

4. Create project

Use the following command to create a name for the  mylaravel project

laravel new mylaravel  

 

5. Turn service project

Laravel provides its own server, you need to start Laravel on the server to access the local host.

First, we need to enter mylaravel directory just created by typing the command cd mylaravel,

$ Cd mylaravel 

Then run the following command to start the server

$ php artisan serv  

 

6. The browser opens http://127.0.0.1:8080

 

 

 

Successfully opened above the page that you have installed and start using Laravel.

 


 

You may encounter problems and solutions

problem:

When you run the following command to open the Web page displays an error message

$ php artisan serv  

Error message:

RuntimeException No application encryption key has been specified.

Solution:

Execute the following command

$ php artisan key:generate

Then re-run

$ php artisan serv  

 

 

Guess you like

Origin www.cnblogs.com/ryanzheng/p/11415969.html