安装laravel

  1. 安装composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '61069fe8c6436a4468d0371454cf38a812e451a14ab1691543f25a9627b97ff96d8753d92a00654c21e2212a5ae1ff36') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
  1. 给composer换国内的源
composer config -g repo.packagist composer https://packagist.phpcomposer.com
  1. 安装Laravel installer
composer global require "laravel/installer"

Make sure to place the ~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your PATH so the laravel executable can be located by your system.

  1. 安装laravel
laravel new blog
  1. 安装所需要的包
cd blog
composer install

可能会出现的报错信息:

Problem 1
    - Installation request for laravel/framework v5.3.28 -> satisfiable by laravel/framework[v5.3.28].
    - laravel/framework v5.3.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 2
    - Installation request for phpunit/phpunit 5.7.4 -> satisfiable by phpunit/phpunit[5.7.4].
    - phpunit/phpunit 5.7.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.

解决方案:
安装php5.6-mbstring和php5.6-xml两个包
在Ubuntu系统下可以用apt-get安装:

sudo apt-get install php5.6-mbstring php5.6-xml

你可能感兴趣的:(安装laravel)